0

我想简单地将一个数据集的经纬度值重新网格到另一个数据集上,它会因坐标不匹配错误而失败。有没有人有解决这个问题的任何提示?

我已将代码和多维数据集描述放在最后。

谢谢!

>>> esm_height = iris.load_cube('model_data/u-bl658/height.nc')
>>> ncepncar_clusters = iris.load('ncepncar/clusters.nc')
>>> foo = esm_height[0].regrid(ncepncar_clusters[0], iris.analysis.Linear())

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-40-c90265ebff43> in <module>
----> 1 foo = esm_height[0].regrid(ncepncar_clusters[0], iris.analysis.Linear())

/nesi/nobackup/niwa00013/williamsjh/miniconda3/envs/kidson2/lib/python3.8/site-packages/iris/cube.py in regrid(self, grid, scheme)
   3802         """
   3803         regridder = scheme.regridder(self, grid)
-> 3804         return regridder(self)
   3805 
   3806 

/nesi/nobackup/niwa00013/williamsjh/miniconda3/envs/kidson2/lib/python3.8/site-packages/iris/analysis/_regrid.py in __call__(self, src)
    943                                  "matching coordinate metadata.")
    944         elif src_cs is None or grid_cs is None:
--> 945             raise ValueError("The rectilinear grid coordinates of the given "
    946                              "cube and target grid must either both have "
    947                              "coordinate systems or both have no coordinate "

ValueError: The rectilinear grid coordinates of the given cube and target grid must either both have coordinate systems or both have no coordinate system but with matching coordinate metadata.

立方体 与目标网格重新网格化

4

1 回答 1

3

好的,我现在已经解决了这个问题!

这是因为源立方体和目标立方体的坐标参考系不同。

这解决了问题...


nzesm_height[0].coord(axis='x').coord_system
GeogCS(6371229.0)

nzesm_height[0].coord(axis='y').coord_system
GeogCS(6371229.0)

ncepncar_clusters[0].coord(axis='x').coord_system = esm_height[0].coord(axis='x').coord_system

ncepncar_clusters[0].coord(axis='y').coord_system = esm_height[0].coord(axis='y').coord_system

foo = nzesm_height[0].regrid(ncepncar_clusters[0], iris.analysis.Linear())

我希望这对其他人有帮助!

于 2020-07-01T02:34:28.083 回答