""" NASA's Global Imagery Browse Services (GIBS) Visualization Product Catalog https://nasa-gibs.github.io/gibs-api-docs/available-visualizations/#visualization-product-catalog """ import matplotlib.pyplot as plt import cartopy.crs as ccrs # fig = plt.figure(figsize=(20, 6)) fig = plt.figure() # 如果自定义地图范围可以不设置 # 自定义地图经纬度范围 ax = fig.add_subplot( 1, 1, 1, projection=ccrs.PlateCarree()) extent = [100, 155, 5, 45] ax.set_extent(extent, crs=ccrs.PlateCarree()) ax.coastlines(linewidth=0.1, zorder=20, resolution='50m') # Natural Earth Valid scales are "110m", "50m", and "10m" # ax.gridlines() # url = 'http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi' # layer = 'BlueMarble_ShadedRelief' # ax.add_wmts(url, layer) # url = 'http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi' # layer = 'ASTER_GDEM_Color_Shaded_Relief' # ax.add_wmts(url, layer) url = 'https://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi' layer = 'VIIRS_CityLights_2012' ax.add_wmts(url, layer) # ax.set_global() # ax.stock_img() # ax.coastlines() fig_name = layer + ".png" # plt.show() # plt.savefig(fig_name, bbox_inches='tight') plt.savefig(fig_name, dpi=512, # 分辨率,每英寸的点数 bbox_inches='tight', pad_inches=0.2, # (默认: 0.1)所保存图形周围的填充量 transparent=True, facecolor='auto', # 默认 auto edgecolor='r', # 默认 auto # papertype='letter', # 3.6之后不支持了。纸张大小,仅支持postscript输出。取值范围为: # {'letter', 'legal', 'executive', 'ledger', 'a0' - 'a10', 'b0' - 'b10'}。默认值为None。 orientation='portrait') # {‘landscape,’ ‘portrait’}: 目前只有后端支持