I am reading a netcdf file which constains the following header information.
dimensions:
time = UNLIMITED ; // (312 currently)
lon = 401 ;
lat = 241 ;
variables:
float time(time) ;
time:standard_name = "time" ;
time:units = "hours since 2020-01-21 00:00:00" ;
time:calendar = "standard" ;
time:axis = "T" ;
float lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degree_east" ;
lon:axis = "X" ;
float lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degree_north" ;
lat:axis = "Y" ;
float tb(time, lat, lon) ;
tb:standard_name = "brightness temperature" ;
tb:units = "K" ;
tb:_FillValue = -9999.f ;
tb:missing_value = -9999.f ;
There are areas where the data is not available, and those areas are filled as -9999.0. So, when this data was created, I specified these areas to have the fill_value of -9999.0, following the netcdf standard.
Now, I am reading the above netcdf file like the following manner.
tb = iris.load_cube("{0:s}".format(input_file_path),"tb")
When I print tb.data
I get
[[[-- -- -- ... 291.15032958984375 292.7417297363281 291.6527404785156]
[-- -- -- ... 293.0906982421875 292.35272216796875 291.66082763671875]
[-- -- -- ... 294.3814392089844 293.40570068359375 292.3965759277344]
...
[312.0113220214844 310.80511474609375 309.0226135253906 ...
293.8000793457031 291.7395935058594 295.8691101074219]
[311.8231201171875 310.74249267578125 309.9149169921875 ...
294.0130615234375 289.27911376953125 295.1790466308594]
[309.64208984375 310.0537414550781 309.95196533203125 ...
295.5054626464844 294.7171936035156 293.8650207519531]]
[[-- -- -- ... 282.6540222167969 284.57452392578125 284.930419921875]
[-- -- -- ... 285.3166809082031 285.3265686035156 285.5889892578125]
[-- -- -- ... 287.7415466308594 287.42376708984375 287.1201477050781]
...
[314.2368469238281 313.30059814453125 311.5663757324219 ...
290.7585144042969 294.0787048339844 295.6382751464844]
[314.0061950683594 313.3076171875 312.81201171875 ...
294.6658020019531 293.7174072265625 294.44140625]
[311.9427185058594 312.5367736816406 312.5076904296875 ...
295.6319580078125 291.3963317871094 294.3623352050781]]
[[-- -- -- ... 276.4613037109375 278.7796936035156 277.3859558105469]
[-- -- -- ... 281.166748046875 280.1023864746094 280.9094543457031]
[-- -- -- ... 282.4347229003906 282.95556640625 282.96893310546875]
...
[313.38421630859375 312.5172119140625 311.1562194824219 ...
292.87835693359375 294.84246826171875 295.73822021484375]
[312.95501708984375 312.3735046386719 312.12713623046875 ...
294.57147216796875 291.1443786621094 294.7926940917969]
[311.0019226074219 311.48681640625 311.5829162597656 ...
291.383544921875 290.3877868652344 295.3729553222656]]
...
where --
indicates numpy masked array, not np.nan
or NaN
. I would like to change this --
value to np.nan
or NaN
when the iris.load_cube()
is called. Is this possible? If not, how can I change this after the iris.load_cube()
is called and retaining the iris cube data structure?
Thanks.