NetCDF file has float32 var with _FillValue
set as 1e37.
import fsspec
import xarray as xr
fs = fsspec.filesystem('s3', anon=True, client_kwargs={'endpoint_url': 'https://mghp.osn.xsede.org'})
url = 's3://rsignellbucket1/COAWST/coawst_us_20220101_01.nc'
ds = xr.open_dataset(fs.open(url), decode_cf=True)
ds.temp[0,0,0,0].values
array(nan)
ds = xr.open_dataset(fs.open(url), decode_cf=False)
ds.temp[0,0,0,0].values
array(1.e+37, dtype=float32)
ds.temp._FillValue
1e+37
json_url = 's3://rsignellbucket1/COAWST/jsons/coawst_us_20220101_01.nc.json'
Try with decode_cf=True
:
s_opts = dict(skip_instance_cache=True, anon=True, client_kwargs={'endpoint_url': 'https://mghp.osn.xsede.org'}) #json
r_opts = dict(anon=True, client_kwargs={'endpoint_url': 'https://mghp.osn.xsede.org'}) #data
fs = fsspec.filesystem("reference", fo=json_url, ref_storage_args=s_opts,
remote_protocol='s3', remote_options=r_opts)
m = fs.get_mapper("")
ds = xr.open_dataset(m, engine="zarr", chunks={},
backend_kwargs=dict(consolidated=False), decode_cf=True)
ds.temp[0,0,0,0].values
array(9.99999993e+36)
Try with decode_cf=False
:
ds = xr.open_dataset(m, engine="zarr", chunks={},
backend_kwargs=dict(consolidated=False), decode_cf=False)
ds.temp._FillValue
0.0
ds.temp[0,0,0,0].values
array(1.e+37, dtype=float32)
Look at the JSON
fs.download('temp/.zattrs', 'foo')
!more foo
{ "_ARRAY_DIMENSIONS": [ "ocean_time", "s_rho", "eta_rho", "xi_rho" ], "_FillValue": 9.999999933815813e+36, "coordinates": "lon_rho lat_rho s_rho ocean_time", "field": "temperature, scalar, series", "grid": "grid", "location": "face", "long_name": "potential temperature", "time": "ocean_time", "units": "Celsius" }