|
1 | | -# ExtremeEvents |
2 | | -Extreme events detection for DeepExtremes project. |
| 1 | +# Workflow for building and analysing Dheed v3 |
| 2 | +Dheed v3 is an ERA5 based global database dry and hot extreme events from 1950 to 2022, developed in the context of ESA funded project [DeepExtremes](https://eo4society.esa.int/projects/deep-extremes/). |
| 3 | +The workflow runs in Julia 1.10.0, except for the consolidation of the data cubes, which is run in python. |
| 4 | +Most steps of the workflow were run on the [MPI BGC-jena](https://bgc-jena.mpg.de) cluster. The input data are hourly ERA5 data retrieved from the [Copernicus Climate Data Store](https://cds.climate.copernicus.eu/) and stored on a local server as netcdf files. Some derived variables were calculated prior to the processing presented here. |
| 5 | + |
| 6 | +## Preprocessing |
| 7 | + |
| 8 | +1. Rechunk ERA5 data, agregating from hourly to daily: t2m (min, mean, max), tp (sum), ssrd (sum). |
| 9 | + |
| 10 | +``` |
| 11 | +cd SlurmScripts |
| 12 | +sbatch rechunk_data.slurm |
| 13 | +``` |
| 14 | + |
| 15 | +*Output*: ERA5Cube.zarr |
| 16 | + |
| 17 | +2. Compute PET on hourly data (t2m, tp , u10, v10, sp, snr (calc), vpd_cf (calc)) and aggregate to daily. |
| 18 | + |
| 19 | +``` |
| 20 | +cd SlurmScripts |
| 21 | +sbatch compute_pet.slurm |
| 22 | +``` |
| 23 | + |
| 24 | +*Output*: PET yearly cubes |
| 25 | + |
| 26 | +3. Rechunk PET and add to ER5cube |
| 27 | + |
| 28 | +The daily PET is rechunked to match the chunk size of the ERA5cube and added to it. |
| 29 | + |
| 30 | +``` |
| 31 | +cd SlurmScripts |
| 32 | +sbatch rechunk_pet.slurm |
| 33 | +``` |
| 34 | + |
| 35 | +*Output*: updated ERA5Cube.zarr |
| 36 | + |
| 37 | +4. Consolidate metadata of ERA5Cube |
| 38 | + |
| 39 | +Metadata from the different variables in the ERA5cube are consolidated, so as to reduce the number of read operations on the backend store. |
| 40 | + |
| 41 | +``` |
| 42 | +python -c import zarr; g = zarr.open_group(path2cube); zarr.consolidate_metadata(g.store) |
| 43 | +``` |
| 44 | + |
| 45 | +*Output*: consolidated ERA5Cube.zarr |
| 46 | + |
| 47 | +5. Compute PEI |
| 48 | + |
| 49 | +The precipitation evaporation index (PEI) is a moving average of the water balance between daily potential evapotranspiration and precipitation. The moving window is 30, 90 or 180 days. |
| 50 | + |
| 51 | +``` |
| 52 | +cd SlurmScripts |
| 53 | +sbatch compute_pei.slurm |
| 54 | +``` |
| 55 | + |
| 56 | +*Output*: PEICube.zarr |
| 57 | + |
| 58 | + |
| 59 | +## Processing |
| 60 | +### Temporal analysis |
| 61 | + |
| 62 | +The time series of the four indicators: t2mmax, PEI_30, PEI_90 and PEI_180 are ranked transformed between 0 and 1. No convolutional spatial filter is run on the results to smoothe the extent of the extreme events. |
| 63 | + |
| 64 | +``` |
| 65 | +cd SlurmScripts |
| 66 | +sbatch smooth_events.slurm |
| 67 | +``` |
| 68 | + |
| 69 | +*Output*: tmax_ranked.zarr and pei_ranks.zarr |
| 70 | + |
| 71 | +### Compute extremes |
| 72 | +A pass over threshold is applied to the rescaled indicators and they are combined into a Byte integer (Int8), with one bit for each indicator and an extra bit encoding for non extremes. The first bit (little end) encodes the maximum temperature extremes. |
| 73 | + |
| 74 | +``` |
| 75 | +cd SlurmScripts |
| 76 | +sbatch compute_events.slurm |
| 77 | +``` |
| 78 | + |
| 79 | +*Output*: EventCube.zarr |
| 80 | + |
| 81 | +### Label extreme events |
| 82 | +Unique labels are assigned to blobs of co-occurrent hot and dry extremes, i.e. where values are uneven (t2mmax extremes) and larger than one (PEI extremes), connected in space and time. A filter is applied before runnning the connected component analysis: temperature extremes must last at least three consecutive days. |
| 83 | + |
| 84 | +*Note*: this will reduce the total number of tmax extremes in the cube... |
| 85 | + |
| 86 | +Because the connected component analysis requires to load the full cube into memory and the algorithm is greedy, the analysis was split into seven tasks, covering each 13 years, with three years overlap between two successive periods. |
| 87 | + |
| 88 | +``` |
| 89 | +cd SlurmScripts |
| 90 | +sbatch label_events.slurm |
| 91 | +``` |
| 92 | + |
| 93 | +*Output*: |
| 94 | +- labelcube_ranked_pot0.01_ne0.1_cmp_S1_T3_1950_1962.zarr |
| 95 | +- labelcube_ranked_pot0.01_ne0.1_cmp_S1_T3_1960_1972.zarr |
| 96 | +- labelcube_ranked_pot0.01_ne0.1_cmp_S1_T3_1970_1982.zarr |
| 97 | +- labelcube_ranked_pot0.01_ne0.1_cmp_S1_T3_1980_1992.zarr |
| 98 | +- labelcube_ranked_pot0.01_ne0.1_cmp_S1_T3_1990_2002.zarr |
| 99 | +- labelcube_ranked_pot0.01_ne0.1_cmp_S1_T3_2000_2012.zarr |
| 100 | +- labelcube_ranked_pot0.01_ne0.1_cmp_S1_T3_2010_2022.zarr |
| 101 | + |
| 102 | +The labels are then merged into a single mergedlabels cube with `scripts/merge_labels.jl`. |
| 103 | + |
| 104 | +*Output*: |
| 105 | +- mergedlabels.zarr |
| 106 | + |
| 107 | +### Compute statistics |
| 108 | +Statistics for all labelled events are computed and gathered in a unique table. |
| 109 | + |
| 110 | +``` |
| 111 | +cd SlurmScripts |
| 112 | +sbatch stats_extremes_merged.slurm |
| 113 | +``` |
| 114 | + |
| 115 | +*Output*: |
| 116 | +- MergedEventStats_landonly.csv |
| 117 | + |
| 118 | +## Figures and Postprocessing |
| 119 | + |
| 120 | +### fig01_workflow.png |
| 121 | + |
| 122 | +Flowchart designed in ppt. |
| 123 | + |
| 124 | +### fig02_workflow-plot-33.png |
| 125 | + |
| 126 | +Example of dry and hot extreme event detection workflow over the 2003 summer heatwave in Europe. |
| 127 | + |
| 128 | +See `scripts/fig4dheed.jl` |
| 129 | + |
| 130 | +### fig03: timeseries |
| 131 | + |
| 132 | +Timeseries of indicators for 2 contrasted locations: Jena (timeseries_11.59_50.92_2012_2023.png) and Niamey (timeseries_2.1254_13.5116_2012_2023.png). |
| 133 | + |
| 134 | +See `scripts/plot_t2mmax.jl` |
| 135 | + |
| 136 | +### fig04 - fig06: Trends -- Annual global/continental summary |
| 137 | + |
| 138 | +Trends in annual global/continental indicators. |
| 139 | + |
| 140 | +Compute annual statistics of indicators, globally and by continent. |
| 141 | + |
| 142 | +See `scripts/plot_ind_annual.jl` |
| 143 | + |
| 144 | +Compute annual statistics of EventCube at global and continental scale, by summing all extremes by type. |
| 145 | + |
| 146 | +See `scripts/hist_EventType.jl` |
| 147 | + |
| 148 | +Plot the results of the EventCube analysis. |
| 149 | + |
| 150 | +``` |
| 151 | +julia --project="ExtremeEvents.toml" plot_EventType.jl |
| 152 | +``` |
| 153 | + |
| 154 | +### fig07: events_stats_ranked_pot0.01_ne0.1_cmp_S1_T3_2010_2022_landonly_1970.png |
| 155 | + |
| 156 | +Extract largest and longest events from `MergedEventStats_landonly` with `largest_labels.jl` and plot statistics with `plot_stats.jl`. |
| 157 | + |
| 158 | +### fig08: largest_ranked_pot0.01_ne0.1_cmp_S1_T3_2010_2022_landonly_1970.png |
| 159 | + |
| 160 | +A map of the spatial footprint of the largest events is generated with `plot_stats.jl`. |
| 161 | + |
| 162 | +### fig09: Validation |
| 163 | + |
| 164 | +Compare MergedEventStats_landonly with table of reported events compiled *a priori* with `SanityCheck.jl`. |
| 165 | + |
| 166 | +### fig10: Lytton.png |
| 167 | + |
| 168 | +Extract timeseries at single locations with `plot_city.jl` |
| 169 | + |
0 commit comments