Suppose in Python, I have read in a netCDF4 file, as follows:
import netCDF4
ds = netCDF4.Dataset('fire_weather_index_2018.nc')
The aspects of the netCDF4 is as follows:
<class 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
Conventions: CF-1.4
created_by: R, packages ncdf4 and raster (version 3.0-7)
date: 2019-10-16 00:07:39
dimensions(sizes): Longitude(1440), Latitude(721), Time(365)
variables(dimensions): int32 crs(), float64 Longitude(Longitude), float64 Latitude(Latitude), float64 Time(Time), float32 FWI(Time, Latitude, Longitude)
groups:
When trying to access a particular datapoint in the file (for example, for day 200, at the coordinates of (27, 47), though this error occurs for every datapoint), as follows:
ds['FWI'][200, 27, 47]
It says the data is masked, but when I query directly ds['FWI'], there are plenty of datapoints. In fact, I can map it accordingly on a world map and all the data would show up.
How do I access / extract a particular data point for the 'FWI' variable in this case?
Longitude(1440), Latitude(721)variables to see which index matches your coordinates. You may be getting a masked value at whatever coordinate happens to be stored at Latitude(27) Longitude(47) in those arrays. – Dave X Nov 15 '21 at 19:09ds['FWI'][200, 27, 47]could well be at 27/72090-90=-86.625° 47/1440180-180=-174.125°, signs depending on the ordering of the Latitude, longitude variables. – Dave X Nov 16 '21 at 22:25