GeoTIFF to NetCDF file with time dimension enabled and CF-Compliant

Research
Climate
UPDATE: as of 4 January 2024 1
Author

Benny Istanto

Published

December 10, 2020

UPDATE: as of 4 January 2024

  1. [15 July 2023] I made a revision to below script, to prevent the result shifted half pixel. Please use the notebook from here: https://gist.github.com/bennyistanto/a8aec5ce3130b13c48609a43daa8bc57
  2. [4 January 2024] I also make other version that could handle daily or time series data from multi year period, grouped by year, process each year. For this purpose, please use this notebook: https://gist.github.com/bennyistanto/0df25c2f8b453dc1f824e7628d51e605

Few months ago, I wrote a step-by-step guideline on how to calculate SPI using CHIRPS data. New problem arises when I try to re-run SPI calculation using latest data, I didn’t imagine before that this process was so complicated. Several questions and idea came up in my mind:

This script will open possibility to create netCDF data using various data, i.e. MODIS Land Surface Temperature (MOD11C3), I can use this data to calculate Potential Evapotranspiration (PET) then the Standardized Precipitation Evapotranspiration Index (SPEI).

See below.

Adjustment is needed if using other CHIRPS timesteps (daily, monthly, etc.) data. And NCO must be installed before using this script.

Python script available in my Gist: https://gist.github.com/bennyistanto/1cf46ed00c2060a5c9d4182bb4da2e54

And below is the notebook version.

I tested using CHIRPS dekad data from Dekad 1, May 2020 to Dekad 3, Oct 2020. And below is the result checked using ncdump.

And visualize the result using Panoply

Back to top