Note
Go to the end to download the full example code.
Onset and Retreat of Monsoon¶
Before proceeding with all the steps, first import some necessary libraries and packages
import xarray as xr
import cartopy.crs as ccrs
import easyclimate as ecl
Open precipitable water example data (must be daily frequency data)
pw_data = ecl.open_tutorial_dataset("pr_wtr_eatm_2022").pr_wtr
pw_data
pr_wtr_eatm_2022.nc ━━━━━━━━━━━━━━━━━ 100.0% | 8.4/8.4 MB | 147.2 MB/s | 0:00:00
Calculate the NPWI index using easyclimate.field.monsoon.calc_index_NPWI
See also
Zeng, X., and E. Lu, 2004: Globally Unified Monsoon Onset and Retreat Indexes. J. Climate, 17, 2241–2248, https://journals.ametsoc.org/view/journals/clim/17/11/1520-0442_2004_017_2241_gumoar_2.0.co_2.xml.
Tang Xu, Chen Baode, Liang Ping, Qian Weihong. Definition and features of the north edge of Asian summer monsoon. Acta Meteorologica Sinica (Chinese), 2009, (1): 83-89. doi: http://dx.doi.org/10.11676/qxxb2009.009
Separation of monsoon affected areas with easyclimate.field.monsoon.find_PW_monsoon_region
Schematization of monsoon impact areas
fig, ax = ecl.plot.quick_draw_spatial_basemap(central_longitude = 200)
PW_monsoon_region.plot(
ax = ax,
cbar_kwargs = {'location': 'bottom'},
transform = ccrs.PlateCarree(),
levels = [0, 1],
colors = ["grey"]
)

INFO:shapefile:File length is exactly the declared header and records size, but misses the EOF byte. Last byte is 0x1a, but that value could also be from the last record's data. Note: In previous versions of PyShp, Writers did not output a .dbf EOF byte so no warning will be given. Set strict=True to raise an Exception for this instead.
<cartopy.mpl.geocollection.GeoQuadMesh object at 0x7305323f1be0>
Calculation of monsoon onset with easyclimate.field.monsoon.calc_NPWI_monsoon_onset
/home/docs/checkouts/easyclimate/checkouts/latest/src/easyclimate/field/monsoon/index_npwi.py:172: FutureWarning: Reductions are applied along the rolling dimension(s) '['time']'. Passing the 'dim' kwarg to reduction operations has no effect.
).sum(dim=time_dim)
Analyzing and mapping the monsoon onset time in the monsoon impact area
fig, ax = ecl.plot.quick_draw_spatial_basemap(central_longitude = 180)
monsoon_onset_date.where(PW_monsoon_region).plot(
ax = ax,
cbar_kwargs = {'location': 'bottom'},
transform = ccrs.PlateCarree(),
cmap = 'Reds'
)

<cartopy.mpl.geocollection.GeoQuadMesh object at 0x7305348a9310>
Calculation of monsoon retreat time with easyclimate.field.monsoon.calc_NPWI_monsoon_retreat
/home/docs/checkouts/easyclimate/checkouts/latest/src/easyclimate/field/monsoon/index_npwi.py:275: FutureWarning: Reductions are applied along the rolling dimension(s) '['time']'. Passing the 'dim' kwarg to reduction operations has no effect.
).sum(dim=time_dim)
Analyzing and mapping the monsoon retreat time in the monsoon impact area
fig, ax = ecl.plot.quick_draw_spatial_basemap(central_longitude = 180)
monsoon_retreat_date.where(PW_monsoon_region).plot(
ax = ax,
cbar_kwargs = {'location': 'bottom'},
transform = ccrs.PlateCarree(),
cmap = 'Reds'
)

<cartopy.mpl.geocollection.GeoQuadMesh object at 0x73053200be60>
Total running time of the script: (0 minutes 15.649 seconds)