将坐标分配给没有坐标的 Xarray 数据集
我有一个 netcdf,我想按坐标进行切片,但是当我打开它时,数据集似乎没有任何关联的坐标。它有尺寸和纬度/经度变量,但有任何坐标,所以它看起来像这样:
<xarray.Dataset>
Dimensions: (y: 10980, x: 10980)
Dimensions without coordinates: y, x
Data variables: (12/20)
lon (y, x) float32 ...
lat (y, x) float32 ...
但我需要这样的东西:
<xarray.Dataset>
Dimensions: (x: 7861, y: 7981)
Coordinates:
* x (x) float64 1.992e+05 1.992e+05 ... 4.35e+05 4.35e+05
* y (y) float64 4.586e+06 4.586e+06 ... 4.347e+06 4.347e+06
Data variables: (12/15)
lon (y, x) float32 ...
lat (y, x) float32 ...
我无法上传 netcdf 文件,因为它们非常重,对此感到抱歉。
任何了解如何做到这一点的人都将非常感激!
I have a netcdf that I want to slice by coordinates, but when I open it, the dataset appears not to have any coordinates associated. It has dimmensions and lat/lon variables, but any coordinates, so it looks like this:
<xarray.Dataset>
Dimensions: (y: 10980, x: 10980)
Dimensions without coordinates: y, x
Data variables: (12/20)
lon (y, x) float32 ...
lat (y, x) float32 ...
But I need something like this:
<xarray.Dataset>
Dimensions: (x: 7861, y: 7981)
Coordinates:
* x (x) float64 1.992e+05 1.992e+05 ... 4.35e+05 4.35e+05
* y (y) float64 4.586e+06 4.586e+06 ... 4.347e+06 4.347e+06
Data variables: (12/15)
lon (y, x) float32 ...
lat (y, x) float32 ...
I cannot upload the netcdf files as they're extremely heavy, sorry about that.
Any grasp of how it can possibly be done would be very appreciated!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论