AusClimateService / plotting_maps

Standardising hazard maps for ACS
4 stars 1 forks source link

Add AGCD inland mask as plotting option #28

Closed MitchellBlack closed 2 months ago

MitchellBlack commented 2 months ago

Would be good to include option in plotting script to apply the AGCD mask over inland areas (say, AGCD_mask = True). David Hoffmann has details on the mask. Will be relevant to some datasets (e.g., AGCD rainfall and derived metrics). Worth adding the mask to the NCI data collection also. When you have time.

xenct commented 2 months ago

Added two new arguments: agcd_mask is a boolean to mask AGCD area for Australia using David's AGCD_masking.py for ACS CMIP6 downscaled data from 1960-2022 [https://doi.org/10.5194/gmd-17-731-2024]. eg agcd_mask=True cmap_bad defines the color of the missing data by updating the colormap. eg cmap_bad = "lightgrey"

ds_pr = xr.open_dataset("/g/data/ia39/australian-climate-service/test-data/CORDEX-CMIP6/bias-adjustment-input/AGCD-05i/BOM/ACCESS-CM2/historical/r4i1p1f1/BARPA-R/v1-r1/day/pr/pr_AGCD-05i_ACCESS-CM2_historical_r4i1p1f1_BOM_BARPA-R_v1-r1_day_19600101-19601231.nc")

# annual total rainfall
da_pr_ann = ds_pr.sum(dim="time").pr

start = datetime.datetime.strptime(ds_pr.time_coverage_start, '%Y%m%dT%H%MZ').strftime("%d %B %Y")
end = datetime.datetime.strptime(ds_pr.time_coverage_end, '%Y%m%dT%H%MZ').strftime("%d %B %Y")

plot_acs_hazard(data = da_pr_ann,
                regions = regions_dict['ncra_regions'],
                cmap=cmap_dict["pr"],
                ticks=tick_dict['pr_annual'],
                cbar_label="annual rainfall [mm]",
                cbar_extend="max",
                title = "Rainfall",
                dataset_name = ds_pr.source_id,
                date_range=f"{start} to {end}",
                agcd_mask=True,
                cmap_bad="lightgrey",
                watermark="");

agcd_mask