Skip to content

About

Scripts for downscaling TraCE-21ka climate data using the CHELSA v1.2 algorithm

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

TraCE-Sahul

Scripts for downscaling TraCE-21ka climate data using the CHELSA v1.2 algorithm for the Sahul region from 22ka BP to 1989 C.E. Additional scripts are provided to harmonise CMIP6 simulations under a range of SSP scenarios to create a seamless dataset to 2100.

TraCESahul workflow

TraCE-21ka model output at 3.75° resolution (left) and downscaled TraCE-Sahul data at 0.05° resolution (centre), both showing 1961–1990 conditions. The right panel shows downscaled CMIP6 data under SSP5-8.5 for 2100. The top row shows average annual temperature (°C), and the bottom row shows average daily precipitation (mm/day).

Overview

TraCESahul provides the processing workflow used to generate high-resolution palaeoclimate data for Sahul from TraCE-21ka climate simulations. The workflow processes the pre-1500 decadal climatologies and the 1500–1990 monthly TraCE-21ka data separately, using the CHELSA v1.2 downscaling approach.

The repository also contains scripts for processing and harmonising CMIP6 data to the downscaled TraCE-Sahul data.

Features

  • Processing of decadal monthly climatologies for periods before 1500 CE.
  • Processing of monthly climate data for 1500–1990 CE.
  • Processing of precipitation and temperature variables.
  • Spatial processing and interpolation of climate and elevation data.
  • Parallelised CHELSA processing for large datasets.
  • Downscaling of TraCE-21ka climate data using CHELSA v1.2.

Installation

System requirements

The workflow requires:

The CHELSA Paleo python packages must be installed separately, as it is not included in this repository.

R packages

The R scripts require several CRAN packages, including terra, data.table, and ncdf4. Additional packages may be required by individual scripts.

Cloning

Close the repository with:

git clone https://github.com/GlobalEcologyLab/TraCESahul.git
cd TraCESahul

The processing scripts contain paths and configuration options that should be adjusted for the local installation and location of input and output data.

Project structure

TraCESahul/
  ├── 01_code/
  │   ├── 00_functions/                    # Shared R processing functions
  │   ├── 01_Decadal_pre1500_halfdegree/   # Pre-1500 decadal processing
  │   ├── 02_Monthly_1500_1990_halfdegree/ # 1500–1990 monthly processing
  │   └── 03_CMIP6/                        # CMIP6 processing
  │
├── 02_data/
  │   ├── 01_inputs/                       # Input data
  │   ├── 02_processed/                    # Processed intermediate data
  │   └── 03_CHELSA_paleo/                 # CHELSA Paleo data
  │
├── TraCE_Sahul.Rproj
└── README.md

Data

The scripts are designed to operate on large climate datasets and associated topographic and climatological inputs. Input and processed data are not included in the repository.

Input data requirements can be found here, with data available for download from the NCAR Geoscience Data Exchange.

Changes to chelsa_paleo

Some minor adjustments were made to the chelsa_paleo Python package to accommodate the processing of the input data and the parallel processing workflow. These changes are described below.

Limiting SAGA threads

saga_api was configured to use a maximum of two OpenMP threads by adding:

saga_api.SG_OMP_Set_Max_Num_Threads(2)

This was necessary to allow multiple timesteps to be processed concurrently without each process attempting to use all available CPU cores (the default).

The modified section of Load_Tool_Libraries is:

def Load_Tool_Libraries(Verbose):
    saga_api.SG_UI_Msg_Lock(True)
    if os.name == 'nt':  # Windows
        os.environ['PATH'] = os.environ['PATH'] + ';' + os.environ['SAGA_32'] + '/dll'
        saga_api.SG_Get_Tool_Library_Manager().Add_Directory(os.environ['SAGA_32'] + '/tools', False)
    else:  # Linux
        saga_api.SG_Get_Tool_Library_Manager().Add_Directory('/usr/local/lib/saga/', False)
    saga_api.SG_UI_Msg_Lock(False)

    saga_api.SG_OMP_Set_Max_Num_Threads(2)  ##< Maximum threads hardcoded to 2

    if Verbose == True:
        print 'Python - Version ' + sys.version
        print saga_api.SAGA_API_Get_Version()
        print 'number of maximum threads used: ' + str(saga_api.SG_OMP_Get_Max_Num_Threads()) ##< print number of threads
        print 'number of loaded libraries: ' + str(saga_api.SG_Get_Tool_Library_Manager().Get_Count())
        print

    return saga_api.SG_Get_Tool_Library_Manager().Get_Count()

Reading the DEM

The DEM input files used in this analysis contain a single layer, regardless of the timestep being downscaled. This is a consequence of the upstream processing, where the low- and high-resolution DEMs were subset using aux_step (see the relevant processing step).

Consequently, the DEM does not need to be indexed using the current timestep (self.time), and Get_Grid(0) is used to read the only layer:

def _build_(self, var):
    if var == 'demproj':
        # ds1 = import_ncdf(self.INPUT + 'orog/oro_high.nc').Get_Grid(self.time)
        ds1 = import_ncdf(self.INPUT + 'orog/oro_high.nc').Get_Grid(0)  ##< DEM contains a single layer
        set_2_latlong(ds1)
        template = import_ncdf(self.INPUT + 'static/merc_template.nc').Get_Grid(0)
        ds = pj2merc(ds1, template)
        setattr(self, var, ds.asGrid())

    if var == 'dem_low':
        # ds = import_ncdf(self.INPUT + 'orog/oro.nc').Get_Grid(self.time)
        ds = import_ncdf(self.INPUT + 'orog/oro.nc').Get_Grid(0)
        ds = change_data_storage(ds)
        setattr(self, var, ds)

    if var == 'dem_high':
        # ds = import_ncdf(self.INPUT + 'orog/oro_high.nc').Get_Grid(self.time)
        ds = import_ncdf(self.INPUT + 'orog/oro_high.nc').Get_Grid(0)
        ds = change_data_storage(ds)
        setattr(self, var, ds)

Citation

If you use the code or resulting datasets, please cite the associated TraCE-Sahul/CHELSA palaeoclimate work and the original TraCE-21ka and CHELSA publications.

About

Scripts for downscaling TraCE-21ka climate data using the CHELSA v1.2 algorithm

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages