CATTOPY是否能够绘制来自另一个行星(例如火星,月球)的地理参考数据?

发布于 2025-02-04 18:24:55 字数 88 浏览 2 评论 0原文

我正在使用来自月球和火星的几个数据集(地形,地壳厚度),并且想知道鉴于参考椭圆形的参考椭圆形的情况是否不同。是否需要创建自定义的椭圆形,还是内置到Cartopy?

I'm working with several data sets from the Moon and Mars (topography, crustal thickness) and was wondering if Cartopy can manipulate these data given the reference ellipsoids are different. Do custom ellipsoids need to be created, or are they built in to Cartopy?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

GRAY°灰色天空 2025-02-11 18:24:55

我想出了自己的工作方式。这是我提出的解决方案...

步骤1

导入摄入术...

import cartopy.crs as ccrs

导入操作检查并加载数据集后,您需要更改Cartopy的 globe 类,以便它不使用WGS84椭圆。只需定义新的半束和半尺寸轴即可,然后告诉曲面术,以免使用陆椭圆形。

img_globe = ccrs.Globe(semimajor_axis = semimajor, semiminor_axis = semiminor, ellipse = None)

步骤2

接下来,选择绘制绘制并识别数据格式的地图投影。我决定使用Mollweide坐标系绘制数据,发现我的数据是在Carree坐标系中定义的。现在,我们可以使用上面定义的新 globe 类来定义数据的地图投影和坐标系。

projection = ccrs.Mollweide(globe = img_globe)
data_crs   = ccrs.PlateCarree(globe = img_globe)

步骤3

最后,使用标准Matplotlib语法绘制数据,其中有两个重要的警告。首先创建实现地图投影的轴。

fig = plt.figure(figsize = (6,6))
ax  = plt.axes(projection = projection)

绘制数据时,您必须通知matplotlib使用 transform 参数如何格式化数据。

ax.imshow(data, extent = extent, cmap = 'viridis', transform = data_crs)

最终结果看起来像这样...

“水星的地壳厚度图”

I figured out how to do this on my own. Here's the solution I came up with...

Step 1

Import Cartopy...

import cartopy.crs as ccrs

After importing Cartopy and loading your data set, you need to change Cartopy's Globe class such that it does not use the WGS84 ellipse. Simply define new semi-major and semi-minor axes and tell Cartopy to refrain from using a terrestrial ellipse.

img_globe = ccrs.Globe(semimajor_axis = semimajor, semiminor_axis = semiminor, ellipse = None)

Step 2

Next, choose a map projection for plotting and identify your data's format. I decided to plot my data using a Mollweide coordinate system and found my data is defined in the Plate Carree coordinate system. Now we can define the map projection and coordinate system for the data using the new Globe class defined above.

projection = ccrs.Mollweide(globe = img_globe)
data_crs   = ccrs.PlateCarree(globe = img_globe)

Step 3

Lastly, plot your data using standard Matplotlib syntax with two important caveats. First create axes that implement the map projection.

fig = plt.figure(figsize = (6,6))
ax  = plt.axes(projection = projection)

When plotting the data, you have to inform Matplotlib how your data are formatted using the transform argument.

ax.imshow(data, extent = extent, cmap = 'viridis', transform = data_crs)

The end result looks like this...

Mercury's crustal thickness map

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文