Skip to content

USF-IMARS/Copernicus2ERDDAP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Copernicus2ERDDAP

Automation for downloading NetCDF files from Copernicus into a directory for ERDDAP.

TODO:

  • copernicus credentials in file
  • fetch copernicus data using Copernicus API (python?)
  • run GenerateDatasetDDS to get dataset.xml for new copernicus dataset

NOTE: could incoporate this into ERDDAP eventually?

Setup

pip install openeo

Usage

Command Line

You can run the script from the command line with an optional date parameter:

# Download granule for today
python copernicus_to_erddap/download_granule.py

# Download granule for a specific date
python copernicus_to_erddap/download_granule.py --date 2025-03-20
# or
python copernicus_to_erddap/download_granule.py -d 2025-03-20

Package Import

Now that the project is set up as a Python package, you can import functions directly:

# Import the main function
from copernicus_to_erddap import get_granule

# Download granule for today
output_file = get_granule()

# Or for a specific date
output_file = get_granule('2025-03-20')

Airflow Integration

The script can be called from Airflow by importing the get_granule function. An example DAG is provided in example_airflow_dag.py.

The function accepts a date parameter (string in format 'YYYY-MM-DD' or datetime object) or defaults to the current date if none is provided.

# In your Airflow task
from copernicus_to_erddap import get_granule

# With a specific date
output_file = get_granule('2025-03-20')
# Or use Airflow's execution_date
output_file = get_granule(execution_date.strftime('%Y-%m-%d'))

cronjob

# get copernicus granule for today
0 0 * * * cd /home/tylar/repos/Copernicus2ERDDAP/ && /usr/bin/python3 /root/Copernicus2ERDDAP/copernicus_to_erddap/download_granule.py

About

Automation for downloading NetCDF files from Copernicus into a directory for ERDDAP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages