<jupyter_start><jupyter_text>全部都是ccrs.PlateCarree()<jupyter_code>mat_extent = [getattr(out_transform, 'c'),
              getattr(out_transform, 'c') + clean_data.shape[1] * getattr(out_transform, 'a'),
              getattr(out_transform, 'f') + clean_data.shape[0] * getattr(out_transform, 'e'),
              getattr(out_transform, 'f')]

colors = ["#33A02C", "#B2DF8A", "#FDBF6F", "#1F78B4", "#999999", "#E31A1C", "#E6E6E6", "#A6CEE3"]

myccrs = ccrs.PlateCarree()

fig, ax = plt.subplots(figsize=(10, 5), dpi=150, subplot_kw={'projection': myccrs})

ax.gridlines(draw_labels=True,
             linewidth=2, color='gray', alpha=0.5, linestyle='--')

ax_im_bar = ax.imshow(clean_data, origin='upper', extent=mat_extent, transform=myccrs,
                      cmap=mpl.colors.LinearSegmentedColormap.from_list("mypalette", colors, N=1000))

china_boundary_gdf_sub.boundary.plot(ax=ax, color='black', linewidth=1)

fig.colorbar(ax_im_bar, orientation='vertical')
# plt.tight_layout()
#
# ax.set_title("china dem")
# ax.set_ylabel("y label")
# ax.set_xlabel("x label")
np.nanmin(clean_data), np.nanmax(clean_data)<jupyter_output><empty_output><jupyter_text>别的投影<jupyter_code>longitude = np.array(
    [getattr(out_transform, 'c') + i * getattr(out_transform, 'a') for i in range(clean_data.shape[1])])
latitude = np.array(
    [getattr(out_transform, 'f') + i * getattr(out_transform, 'e') for i in range(clean_data.shape[0])])

colors = ["#33A02C", "#B2DF8A", "#FDBF6F", "#1F78B4", "#999999", "#E31A1C", "#E6E6E6", "#A6CEE3"]
center_china_point = china_boundary_gdf.centroid[0]

# 新的兰伯特投影
new_crs = ccrs.Orthographic(central_longitude=center_china_point.x,
                                central_latitude=center_china_point.y)
myccrs = ccrs.PlateCarree()

fig, ax = plt.subplots(figsize=(10, 10), dpi=100, subplot_kw={'projection': new_crs})

ax.gridlines(draw_labels=True,
             linewidth=2, color='gray', alpha=0.5, linestyle='--')
ax_im_bar = ax.contourf(longitude, latitude, clean_data,  # [::-1,:]
                            np.arange(0, np.nanmax(clean_data), 100.0),
                            transform=ccrs.PlateCarree(),
                            cmap=mpl.colors.LinearSegmentedColormap.from_list("mypalette", colors, N=1000),
                            extend='both', origin='upper')
china_boundary_gdf_sub.to_crs(new_crs.proj4_init).boundary.plot(ax=ax, edgecolor='black', linewidth=1)
fig.colorbar(ax_im_bar, orientation='vertical')
# fig.savefig('test1226.png')
fig.savefig(f"test1226_china_{datetime.datetime.now().strftime('%Y-%m-%d %X')}.png")<jupyter_output>/var/folders/rn/1sl8q5g56bb377glk8qyp_k40000gn/T/ipykernel_685/3706497031.py:7: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  center_china_point = china_boundary_gdf.centroid[0]
{'fraction_non_alphanumeric': 0.1629425919559986, 'fraction_numerical': 0.044001375042970095, 'mean_word_length': 4.606936416184971, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '259495', 'license': 'MIT', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1137, 'n_words': 159, 'path': 'python_GIS/0601_dem.ipynb', 'repo_name': 'yuanzhoulvpi2017/tiny_python', 'size': '2909'}