Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAN #1239

Open
wangshuaicumt opened this issue Mar 7, 2023 · 6 comments
Open

NAN #1239

wangshuaicumt opened this issue Mar 7, 2023 · 6 comments

Comments

@wangshuaicumt
Copy link

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

@jswhit
Copy link
Collaborator

jswhit commented Mar 7, 2023

are you using xarray?

@wangshuaicumt
Copy link
Author

are you using xarray?

Yeah.

@wangshuaicumt
Copy link
Author

are you using xarray?

Is there a better way to achieve?

@jswhit
Copy link
Collaborator

jswhit commented Mar 8, 2023

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).

@wangshuaicumt
Copy link
Author

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]

Figure_1

@mgrover1
Copy link

mgrover1 commented Mar 30, 2023

You should specify

ds.sel(lat=.., lon=..., method='nearest' )

without that, it is trying to find that exact value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants