【问题标题】:regridding fails in iris due to coordinate system disagreement由于坐标系不一致,虹膜重新网格化失败
【发布时间】:2020-10-20 10:14:59
【问题描述】:

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

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

谢谢!

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

cube to be regridded cube with target grid

【问题讨论】:

    标签: python interpolation python-iris


    【解决方案1】:

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

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

    这解决了问题...

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

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

    【讨论】:

      猜你喜欢
      • 2019-04-06
      • 1970-01-01
      • 2022-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-18
      • 2013-07-03
      • 1970-01-01
      相关资源
      最近更新 更多