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

PyQG Ross2022 #239

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
10 changes: 10 additions & 0 deletions recipes/PyQG_subgrid_forcing_Ross2022/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: 'PyQG Subgrid Forcing (Ross et al., 2022)'
description: 'Data from "Benchmarking of machine learning ocean subgrid parameterizations in an idealized model" by Ross et al., 2022'
recipes:
- id: PyQG_Ross2022
object: 'recipe:recipe'
cmdupuis3 marked this conversation as resolved.
Show resolved Hide resolved
maintainers:
- name: 'Christopher Dupuis'
github: cmdupuis3
bakery:
id: 'pangeo-ldeo-nsf-earthcube'
37 changes: 37 additions & 0 deletions recipes/PyQG_subgrid_forcing_Ross2022/recipe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pangeo_forge_recipes.patterns import pattern_from_file_sequence
from pangeo_forge_recipes.recipes import XarrayZarrRecipe

# from pangeo_forge_recipes.recipes import setup_logging
# setup_logging()

# key: file name, value: globus address, time chunk size
file_dict = {
'eddy/high_res.zarr': ('https://g-402b74.00888.8540.data.globus.org/eddy/high_res.zarr', 11),
'eddy/low_res.zarr': ('https://g-402b74.00888.8540.data.globus.org/eddy/low_res.zarr', 87),
'eddy/forcing1.zarr': ('https://g-402b74.00888.8540.data.globus.org/eddy/forcing1.zarr', 1),
'eddy/forcing2.zarr': ('https://g-402b74.00888.8540.data.globus.org/eddy/forcing2.zarr', 1),
'eddy/forcing3.zarr': ('https://g-402b74.00888.8540.data.globus.org/eddy/forcing3.zarr', 1),
'jet/high_res.zarr': ('https://g-402b74.00888.8540.data.globus.org/jet/high_res.zarr', 11),
'jet/low_res.zarr': ('https://g-402b74.00888.8540.data.globus.org/jet/low_res.zarr', 87),
'jet/forcing1.zarr': ('https://g-402b74.00888.8540.data.globus.org/jet/forcing1.zarr', 1),
'jet/forcing2.zarr': ('https://g-402b74.00888.8540.data.globus.org/jet/forcing2.zarr', 1),
'jet/forcing3.zarr': ('https://g-402b74.00888.8540.data.globus.org/jet/forcing3.zarr', 1),
}


def pattern(v):
return pattern_from_file_sequence([v[0]], concat_dim='time', file_type='unknown')


def xr2zarr(v):
return XarrayZarrRecipe(
pattern(v),
target_chunks={'time': v[1]},
cache_inputs=False,
xarray_open_kwargs={'engine': 'zarr'},
)


recipes = {k: xr2zarr(v) for k, v in file_dict.items()}

[recipe.to_function()() for recipe in recipes.values()] # probably not idiomatic, plz fix
cmdupuis3 marked this conversation as resolved.
Show resolved Hide resolved