我在使用 Ocean Color - Climate Change Initiative(OC-CCI 数据)时遇到了
AstroPy
包中的问题。即,通过以下方式提取纬度和经度:
lats = nc.lat.data
lons = nc.lon.data
并将它们插入
loc = astropy.coordinates.EarthLocation(lons, lats)
返回:
Coordinates could not be parsed as either geocentric or geodetic, with respective exceptions "from_geocentric() missing 1 required positional argument: 'z'" and "Input parameters lon, lat, and height cannot be broadcast"
但是,对 SeaHawk 数据应用相同的过程,我没有遇到这样的问题,即使 SeaHawk 的
lat
和 lon
数组是二维的,与 OC-CCI 的相同......
有谁知道解决方法或如何根据纬度和经度计算椭球体高度?
我尝试创建网格网格,将数据直接从 netCDF 文件输入到函数中,但错误仍然存在。
从错误信息来看,我猜测lons或lats的值基本上超出了范围。在这种情况下,
EarthLocation
需要一些其他输入,而不仅仅是经度和纬度。例如,如果纬度为 100,或经度为 -181(更有可能),您会收到此错误。
一个简单的 3 步程序:offset – module – -offset 可以解决这个问题。或者使用诸如
astropy.coordinates.Angle(lons).wrap_at('180d')
之类的东西。