Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
# read the netCDF file and print its list of variables
nc = read("fc_12.nc")
vars = variables(nc)
print(vars)   #  we could also do:  print(variables(nc))

# set the current variable to be t2m and print its attributes
setcurrent(nc, 't2m')
atts = attributes(nc)
print(atts)

Run the macro and see - this is what it printsshould print:

Code Block
[longitude,latitude,time,t2m,d2m]
ATTRIBUTES(scale_factor:0.001611,add_offset:254.569370,missing_value:-32767,units:K,long_name:2 metre temperature)

...

First, use the values() function to extract arrays of lats, lons and T2m from the CSV data. These will be returned in variables of type vector - this is an in-memory array of double-precision numbers.

Panel
vector or list values( table, number )
vector or list values( table, string )

Returns the given column specified either by an index (starting at 1) or a name (only valid if the table has a header row). If the column type is number, a vector is returned; if it is string, then a list of strings is returned. If the column cannot be found, an error message is generated.

...