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)

...