1

I extract temperature data from the netcdf4 file using python I used these code but it returns only null values.

from netCDF4 import Dataset

nc = Dataset("GLDAS_NOAH025_3H.A20170102.0000.021.nc4","r")
for temp in nc.variables['AvgSurfT_inst'] :
    print (temp)

Output:

[[[-- -- -- ..., -- -- --]
  [-- -- -- ..., -- -- --]
  [-- -- -- ..., -- -- --]
  ..., 
  [-- -- -- ..., -- -- --]
  [-- -- -- ..., -- -- --]
  [-- -- -- ..., -- -- --]]]
3
  • Can you point to a source for your datafile so we could duplicate?
    – Dave X
    Oct 3 '17 at 18:34
  • Per the image on disc.sci.gsfc.nasa.gov/datasets/GLDAS_NOAH025_3H_V2.1/… it looks like the head and tail of the dataset could very well be nulls.
    – Dave X
    Oct 3 '17 at 18:38
  • yes Dave X , tail and head datasets are null. And nc.variables['AvgSurfat_inst'][0,:] show actual result. I solved my problem. And thanks for reply. Oct 3 '17 at 18:42
0

Per the image on https://disc.sci.gsfc.nasa.gov/datasets/GLDAS_NOAH025_3H_V2.1/summary?keywords=GLDAS it looks like the head and tail of the dataset could very well be nulls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.