XSeasonDetect
is a Python tool designed for the detection and analysis of meteorological and climatological seasons using Machine Learning, designed to be compatible with xarray
.
The tool is built upon a Machine Learning algorithm proposed by A. J Cannon in the article Defining climatological seasons using radially constrained clustering (2005).
Create a new project with:
XSeas_newproj --name <project_name>
In the data/raw/ERA5 create a file for each variable you wanto to include into the analysis. Fill each folder wit han .nc file named final.nc
.
Then run the script for the preprocessing of ERA5 data:
XSeas_preprocessERA
This script automates the preprocessing of ERA5 climate data stored in NetCDF format. Below is a step-by-step explanation of how the script works:
-
Input Data Requirements:
- Raw NetCDF files should be organized into subfolders within
data/raw/ERA5
. - A target grid file (
config/target_grid.txt
) must be present to define the spatial grid resolution. - A geographic boundary file (
data/raw/shapefiles/boundary.gpkg
) is required to clip the data spatially.
- Raw NetCDF files should be organized into subfolders within
-
Processing Workflow:
- Folder Detection: The script scans
data/raw/ERA5
for subfolders containing raw NetCDF files. - Directory Setup: For each folder, it creates intermediate (
data/temp/ERA5
) and output (data/preprocessed/ERA5
) directories if they don’t already exist.
- Folder Detection: The script scans
-
Preprocessing: The following operations are applied to each folder:
- Regridding: Matches the spatial resolution defined in the target grid file.
- Clipping: Restricts the data to the area defined in the boundary file.
- Temporal Filtering: Keeps only the data within the specified time range (default: 1960–2020).
- Overwrite Handling: If a preprocessed file (final.nc) already exists in the output directory, the user is prompted to overwrite or skip.
-
Output:
- Preprocessed data is saved as final.nc in the corresponding folder within data/preprocessed/ERA5.