Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmip6 wrf wus #247

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
28 changes: 28 additions & 0 deletions recipes/cmip6-wrf-wus/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
title: CMIP6 GCMs downscaled using WRF
description: >-
Downscaling of CMIP6 GCMs conducted at UCLA for the western US over 45km and
9km grid-spacing, and over California and Wyoming for 3km grid-spacing in some
cases.
recipes:
dict_object: 'recipe:recipes'
provenance:
providers:
- name: UCLA Center for Climate Science
description: 'University of California, Los Angeles Center for Climate Science'
roles:
- producer
- processor
- licensor
url: 'https://dept.atmos.ucla.edu/alexhall/downscaling-cmip6'
- name: AWS
description: AWS Sustainability Data Initiative
roles:
- host
url: 'https://registry.opendata.aws/wrf-cmip6/'
license: CC BY-SA 4.0
maintainers:
- name: Naomi Goldenson
orcid: 0000-0003-0656-4168
github: thenaomig
bakery:
id: pangeo-ldeo-nsf-earthcube
34 changes: 34 additions & 0 deletions recipes/cmip6-wrf-wus/recipe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import functools

import pandas as pd

from pangeo_forge_recipes.patterns import ConcatDim, FilePattern
from pangeo_forge_recipes.recipes import HDFReferenceRecipe

recipe_dict = {
'cesm2_r11i1p1f1_ssp370': {
'url_format': (
'https://wrf-cmip6-noversioning.s3.amazonaws.com/downscaled_products/gcm/'
'cesm2_r11i1p1f1_ssp370/hourly/{Time:%Y}/d02/auxhist_d01_{Time:%Y-%m-%d_%X}'
),
'times': pd.date_range('2014-09-01', '2100-08-31 23:00', freq='H'),
}
}


def make_url(Time, URL_FORMAT=None):
return URL_FORMAT.format(Time=Time)


recipes = {}
for key, value in recipe_dict.items():
times = value['times']
time_concat_dim = ConcatDim('Time', times)
make_url_partial = functools.partial(make_url, URL_FORMAT=value['url_format'])
pattern = FilePattern(make_url_partial, time_concat_dim)
recipes[key] = HDFReferenceRecipe(
pattern,
concat_dims=['Time'],
coo_map={'Time': [str(time) for time in times]},
preprocess=None,
)