netcdf4-python
netcdf4-python copied to clipboard
NAN
ps_point = d1.sel(lon='117.17638888845157', lat='35.47979166666699') print(ps_point.values)
When I run the codes, but the terminal shows NAN. How to solve it?
nan
are you using xarray?
are you using xarray?
Yeah.
are you using xarray?
Is there a better way to achieve?
this is really not a netcdf4-python issue. I suspect you are select a point with missing or undefined data, but you would have to ask an xarray expert (maybe here).
this is really not a netcdf4-python issue. I suspect you are select a point with missing or undefined data, but you would have to ask an xarray expert (maybe here).
Yeah, thanks. The data I read out using xray is like this, and the graph drawn is as follows.
<xarray.DataArray 'z' (lat: 1180, lon: 1910)> [2253800 values with dtype=float32] Coordinates:
- lon (lon) float64 116.2 116.2 116.2 116.2 ... 117.2 117.2 117.2 117.2
- lat (lat) float64 35.48 35.48 35.48 35.48 ... 35.97 35.97 35.97 35.97 Attributes: long_name: z actual_range: [-153.15245056 136.86753845]

You should specify
ds.sel(lat=.., lon=..., method='nearest' )
without that, it is trying to find that exact value.