北半球#
北半球底图布局 (cedarkit.maps.domains.NorthPolarMapDomain
) 绘制北半球图形,使用北半球立体投影 (cartopy.crs.NorthPolarStereo
),默认中心经度东经 110 度。
准备#
导入需要的包
import numpy as np
import pandas as pd
from cedarkit.maps.chart import Panel
from cedarkit.maps.domains import NorthPolarMapDomain
from cedarkit.maps.map import set_default_map_package
from cedarkit.maps.style import ContourStyle
from cedarkit.maps.colormap import get_ncl_colormap
设置使用 CEMC 地图包
set_default_map_package("cedarkit.maps.map.cemc")
'cedarkit.maps.map.cemc'
定义绘图样式
contour_lev = np.arange(-16, 25, 2)
color_map = get_ncl_colormap(
"rainbow+white+gray",
index=np.arange(38, 207, 8),
)
t_style = ContourStyle(
colors=color_map,
levels=contour_lev,
fill=True,
)
绘制#
绘制底图布局
domain = NorthPolarMapDomain()
panel = Panel(domain=domain)
domain.set_title(
panel=panel,
graph_name="850 hPa TEMP ($^\circ$C) shadow",
system_name="CMA-GFS",
start_time=pd.to_datetime("2024-03-21 00:00"),
forecast_time=pd.to_timedelta("24h"),
)
domain.add_colorbar(panel=panel, style=t_style)
panel.show()
<>:6: SyntaxWarning: invalid escape sequence '\c'
<>:6: SyntaxWarning: invalid escape sequence '\c'
/scratch/ipykernel_3846227/2093263972.py:6: SyntaxWarning: invalid escape sequence '\c'
graph_name="850 hPa TEMP ($^\circ$C) shadow",
![../../_images/171fcdc0063d5c004948879ca9c87d1ec53d3a427aaf46d99e2f3c9a97ccfb5f.png](../../_images/171fcdc0063d5c004948879ca9c87d1ec53d3a427aaf46d99e2f3c9a97ccfb5f.png)