Skip to content

Commit

Permalink
CMORizer for NASA MERRA reanalysis (#3039)
Browse files Browse the repository at this point in the history
Co-authored-by: Rémi Kazeroni <[email protected]>
  • Loading branch information
2 people authored and Javier Vegas-Regidor committed Jan 14, 2024
1 parent 7eba86a commit ef89d3e
Show file tree
Hide file tree
Showing 8 changed files with 432 additions and 5 deletions.
3 changes: 3 additions & 0 deletions doc/sphinx/source/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ A list of the datasets for which a CMORizers is available is provided in the fol
+------------------------------+------------------------------------------------------------------------------------------------------+------+-----------------+
| MAC-LWP | lwp, lwpStderr (Amon) | 3 | NCL |
+------------------------------+------------------------------------------------------------------------------------------------------+------+-----------------+
| MERRA | cli, clivi, clt, clw, clwvi, hur, hus, lwp, pr, prw, ps, psl, rlut, rlutcs, rsdt, rsut, rsutcs, ta, | 3 | NCL |
| | tas, ts, ua, va, wap, zg (Amon) | | |
+------------------------------+------------------------------------------------------------------------------------------------------+------+-----------------+
| MERRA2 | sm (Lmon) | 3 | Python |
| | clt, pr, evspsbl, hfss, hfls, huss, prc, prsn, prw, ps, psl, rlds, rldscs, rlus, rlut, rlutcs, rsds, | | |
| | rsdscs, rsdt, tas, tasmin, tasmax, tauu, tauv, ts, uas, vas, rsus, rsuscs, rsut, rsutcs, ta, ua, va, | | |
Expand Down
7 changes: 7 additions & 0 deletions esmvaltool/cmorizers/data/datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,13 @@ datasets:
individually or by using the option "download all".
Data is freely available, but a registration is required.
MERRA:
tier: 3
source: https://goldsmr3.gesdisc.eosdis.nasa.gov/data/MERRA_MONTHLY/
last_access: 2023-02-01
info: |
Use automatic download. That will download monthly data.
MERRA2:
tier: 3
source: https://goldsmr4.gesdisc.eosdis.nasa.gov/data/MERRA2_MONTHLY/ https://goldsmr5.gesdisc.eosdis.nasa.gov/data/MERRA2_MONTHLY/
Expand Down
57 changes: 57 additions & 0 deletions esmvaltool/cmorizers/data/downloaders/datasets/merra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""Script to download MERRA."""

from datetime import datetime

from dateutil import relativedelta

from esmvaltool.cmorizers.data.downloaders.wget import NASADownloader


def download_dataset(config, dataset, dataset_info, start_date, end_date,
overwrite):
"""Download dataset.
Parameters
----------
config : dict
ESMValTool's user configuration
dataset : str
Name of the dataset
dataset_info : dict
Dataset information from the datasets.yml file
start_date : datetime
Start of the interval to download
end_date : datetime
End of the interval to download
overwrite : bool
Overwrite already downloaded files
"""
if not start_date:
start_date = datetime(1979, 1, 1)
if not end_date:
end_date = datetime(2015, 12, 31)
loop_date = start_date

downloader = NASADownloader(
config=config,
dataset=dataset,
dataset_info=dataset_info,
overwrite=overwrite,
)

while loop_date <= end_date:
year = loop_date.year
downloader.download_folder(
"https://goldsmr3.gesdisc.eosdis.nasa.gov/data/MERRA_MONTHLY/"
f"MAIMNXINT.5.2.0/{year}/")
downloader.download_folder(
"https://goldsmr3.gesdisc.eosdis.nasa.gov/data/MERRA_MONTHLY/"
f"MAIMCPASM.5.2.0/{year}/")
downloader.download_folder(
"https://goldsmr3.gesdisc.eosdis.nasa.gov/data/MERRA_MONTHLY/"
f"MATMNXRAD.5.2.0/{year}/")
downloader.download_folder(
"https://goldsmr3.gesdisc.eosdis.nasa.gov/data/MERRA_MONTHLY/"
f"MATMFXCHM.5.2.0/{year}/")

loop_date += relativedelta.relativedelta(years=1)
4 changes: 2 additions & 2 deletions esmvaltool/cmorizers/data/downloaders/wget.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def download_folder(self, server_path, wget_options=None):
"""
if wget_options is None:
wget_options = []
wget_options = self._wget_common_options + ["-np", "--accept=nc,nc4"
] + wget_options
wget_options = self._wget_common_options + [
"-np", "--accept=nc,nc4,hdf"] + wget_options
super().download_folder(server_path, wget_options)

def download_file(self, server_path, wget_options=None):
Expand Down
Loading

0 comments on commit ef89d3e

Please sign in to comment.