use of ind function, with a complicated set of tests

From: Donna Cote <d-cote_at_nyahnyahspammersnyahnyah>
Date: Thu, 09 Apr 2009 18:37:13 -0500

Mary helped me with some of this code; getting me started with reading
an nc file, collecting a list array of all of the file's variables, and
making a loop where I tested each variable for its type and dimensions
(at least).

    f=addfile... "r")
    do l=0, varNamesSize-1
      tmp = f->$varNames(l)$
      if ( .and. isdimnamed(tmp,0) .and. (tmp!0 .eq. "recNum")
    ) then ; (B) ; skip this variable and go to the next in the
    varNames array
        if (l.eq.0)
          StringOfVarNamesToInsert=StringOfVarNamesToInsert+ ", "
        end if
      end if
    end do

What I have, so far, creates a string of variable names delimited with a
comma. Example below. I would rather have ncl create an array that is a
subset of the varNames array where the names in the new array have 1) a
rank of 1+, 2) a named dimension !0, and 3) the !0 dimension name
matching "recNum"

How is that for compliecated? I sort of imagine that I would come up
with a function which does these tests and returns True or False to
ind(); Maybe:

    newVarNames = ind( myfunction(tmp).eq. True )

Am I on the right track? or what has someone found to work for them,
along these lines?

Example string of variable names:
   rawMETAR, correction, maxTemp24HourQCD, maxTemp24HourQCR,
maxTemp24HourQCA, maxTemp24HourDD, maxTemp24Hour, minTemp24HourQCD,
minTemp24HourQCR, minTemp24HourQCA, minTemp24HourDD, minTemp24Hour,
altimeterQCD, altimeterQCR, altimeterQCA, altimeterDD, altimeter,
timeObs, elevation, longitude, latitude, locationName, stationName, wmoId


ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Thu Apr 09 2009 - 17:37:13 MDT

This archive was generated by hypermail 2.2.0 : Sun Apr 12 2009 - 14:28:35 MDT