Skip to content

Conversation

lelavathy
Copy link
Collaborator

@lelavathy lelavathy commented Sep 10, 2025

This issue is to upload and integrate a Python script that prepares ERA5-Land climate data for the Virtual Ecosystem (VE) model. The script:

  1. Loads a TOML site definition with projected grid coordinates.
  2. Loads monthly ERA5-Land NetCDF (2010–2020) climate data.
  3. Converts units (K → °C, m → mm, Pa → kPa, J/m² → W/m²).
  4. Adds derived variables such as relative humidity, mean annual temperature, and constant CO₂.
  5. Interpolates ERA5-Land data to the TOML grid (90×90 m).
  6. Reformats variables and coordinates to VE-style NetCDF.
  7. Saves the processed dataset for use as VE climate driver inputs.

Additional Notes:

  • The script uses numpy, xarray, tomllib, and pyproj.
  • Spatial downscaling/topographic correction is not yet implemented.
  • The output NetCDF follows VE conventions with x, y, and time_index dimensions.

This issue will serve as a reference for uploading, testing, and documenting the VE climate data preparation workflow.

Fixes #105

@lelavathy lelavathy self-assigned this Sep 10, 2025
@lelavathy
Copy link
Collaborator Author

@vgro

Could you please review it and check the following:

  1. Whether all required variables for the Virtual Ecosystem have been added.
  2. Whether the unit conversions (temperature, precipitation, pressure, solar radiation, etc.) are correct.

Copy link
Collaborator

@vgro vgro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good! I added a few points to update, but happy for you to merge this when the checks are successful

@davidorme
Copy link
Collaborator

@lelavathy I've now merged #86 so the cdsapi downloader script and my initial version of this script are now in analysis/abiotic so the only thing to do now is to move this file to the same location and then just review the metadata and code of the two versions so we can delete mine and replace it with this consolidated version?

@lelavathy
Copy link
Collaborator Author

@lelavathy I've now merged #86 so the cdsapi downloader script and my initial version of this script are now in analysis/abiotic so the only thing to do now is to move this file to the same location and then just review the metadata and code of the two versions so we can delete mine and replace it with this consolidated version?

@davidorme I have moved this file to analysis/abiotic. Basically, I have merged part of code from maliau_era5_download_reproject into my climate processing script. @vgro could you please review the merged script?


# Use the rasterio accessor tools to reproject the data

# NOTE: The reprojection is automatically applying downscaling to the 90m grid
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't call this downscaling here, it's really just an interpolation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidorme I think we can delete this maliau_era5_download_and_reproject script. I have already integrated this script into maliau_climate_data_processing_script.

#
# https://rasterio.readthedocs.io/en/stable/api/rasterio.enums.html#rasterio.enums.Resampling
#
# We might want to use a different interpolation strategy to give a smooth surface -
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part could be replaced with the comment you made in the other script about downscaling in the future

Copy link
Collaborator

@vgro vgro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@annarallings annarallings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with @vgro requested changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upload Climate Data Preparation Script
4 participants