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


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

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 }'" )

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

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


  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
Code NP1
Naval Oceanographic Office
Stennis Space Center, MS

ncl-talk mailing list
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