我刚来这地方。首先,我非常感谢您的时间和考虑。我有两个关于在 python 中管理 2 个不同的 netcdf 文件的问题。我进行了很多搜索,但不幸的是我找不到解决方案。
1-我有一个 netcdf 文件,其坐标如下:
time datetime64[ns] 2016-08-16T22:00:00
* y (y) int32 220000 ... 620000
* x (x) int32 20000 ... 720000
lat (y, x) float64 dask.array<shape=(401, 701),
lon (y, x) float64 dask.array<shape=(401, 701),
Run Code Online (Sandbox Code Playgroud)
我需要将坐标更改为经度/纬度,以便我可以根据特定的经度/纬度坐标(通过使用 xarray)对区域进行切片。但我不知道如何将 x 和 y 更改为 lon lat。这是我的代码:
import xarray as xr
import matplotlib.pyplot as plt
p = "R_201608.nc"
ds = xr.open_mfdataset(p)
q=ds.RR.sel(time='2016-08-16T21:00:00')
Run Code Online (Sandbox Code Playgroud)
2-与 1 类似,我有另一个 netcdf 文件,其坐标如下:
* X (X) float32 557600.0 .. 579400.0
* Y (Y) float32 5190600 ... …Run Code Online (Sandbox Code Playgroud) netcdf coordinate-transformation python-3.x python-xarray netcdf4