Possible Bug in numAsciiRow() of NCL4.2.0.a034

From: Lunde, Bruce N CIV NAVOCEANO, NP1 <bruce.lunde_at_nyahnyahspammersnyahnyah>
Date: Thu, 7 Dec 2006 11:39:37 -0800

Hello,

I am using NCL Version 4.2.0.a034 64-bit on AIX.

(1)
I found the following problem with the function numAsciiRow():
  * There was no space after the "-l" option (thus wc was interpreting
      fNam as an option).
  * wc does not need the single quotes around it, but it doesn't hurt.

Here is my update to the routine:

  function numAsciiRow (fNam:string)
  ;;; nrow_s = systemfunc("'wc' -l" + fNam +" | awk '{print }'" )
    nrow_s = systemfunc("wc -l " + fNam +" | awk '{print }'" )

(2)
Given the assumptions that the function numAsciiCol() makes, it could be
simplified (and sped up ?) by using the following one-line command in
place
of its code which reads the entire file (via asciiread()):

  ncol = stringtointeger( systemfunc("head -1 "+fNam+" | wc -w") )

VERSUS

  function numAsciiCol (fNam:string)
    tokens = stringtointeger( systemfunc("wc -w "+fNam) )
    filString = asciiread ( fNam, -1, "string")
    nrow = dimsizes(filString)
    ncol = tokens/nrow

Thanks, Bruce

P.S. The function numAsciiRow() uses a different logic in NCL
     version 4.2.0.a030, which is more like that of the current
     logic in numAsciiCol() (and works without error).

=====
Bruce Lunde
Bruce.Lunde_at_navy.mil
228-688-5843
Code NP1
Naval Oceanographic Office
Stennis Space Center, MS
=====

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 07 2006 - 12:39:37 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 07 2006 - 16:52:37 MST