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

[WIP] Add daymet #213

Draft
wants to merge 47 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1d74af4
Test
yuvipanda Oct 28, 2022
532209c
Remove enums
yuvipanda Oct 28, 2022
2bc3674
Fucking scope shit
yuvipanda Oct 28, 2022
1dbf425
Till last year
yuvipanda Oct 28, 2022
42573b1
Make it a dict
yuvipanda Oct 28, 2022
a494b48
debug
yuvipanda Oct 28, 2022
d2d43d7
Use cmr
yuvipanda Oct 28, 2022
3208078
Support earthdata login
yuvipanda Oct 28, 2022
d65ab19
Split things into one per region per variable
yuvipanda Oct 28, 2022
961835b
Set nitems_per_input
yuvipanda Oct 28, 2022
3c0a3e5
Fix name
yuvipanda Oct 28, 2022
34f2cbc
Don't shard by region
yuvipanda Oct 28, 2022
2c8e8c4
Try a different nitems_per_file
yuvipanda Oct 28, 2022
0dc6e0a
pass in nitems elsewhere
yuvipanda Oct 28, 2022
be9590d
Try this
yuvipanda Oct 28, 2022
5a50ed2
Try just 1 input per chunk
yuvipanda Oct 28, 2022
5c6b152
Merge all vars into one store
yuvipanda Oct 28, 2022
f65b42e
Try going one level deeper
yuvipanda Oct 28, 2022
eb4c12d
Fuck serialization
yuvipanda Oct 28, 2022
4537e10
Pass as args
yuvipanda Oct 28, 2022
77ae336
Fix ordering
yuvipanda Oct 28, 2022
9cc0228
Try amend
yuvipanda Oct 28, 2022
3c9058c
XarrayZarr can't handle more than 1 MergeDim apparently
yuvipanda Oct 28, 2022
0d7df7b
Revert "XarrayZarr can't handle more than 1 MergeDim apparently"
yuvipanda Oct 28, 2022
dcfff1e
Revert "Revert "XarrayZarr can't handle more than 1 MergeDim apparent…
yuvipanda Oct 28, 2022
e5243ad
Revert "Revert "Revert "XarrayZarr can't handle more than 1 MergeDim …
yuvipanda Oct 29, 2022
f353f41
Try
yuvipanda Oct 29, 2022
0c9d57e
Try dict
yuvipanda Oct 29, 2022
1096f8a
Recipe name
yuvipanda Oct 29, 2022
717edef
Try partial
yuvipanda Oct 29, 2022
758864b
Debug
yuvipanda Oct 29, 2022
107b150
Try multiple concat dims
yuvipanda Oct 29, 2022
83d2263
What if we return none
yuvipanda Oct 29, 2022
1f8feb8
Fuck
yuvipanda Oct 29, 2022
3fe8f19
Try just na
yuvipanda Oct 29, 2022
e6c215f
blah
yuvipanda Oct 29, 2022
87ee3a5
fadf
yuvipanda Oct 29, 2022
e383f2a
try just one thing
yuvipanda Oct 29, 2022
6e1a899
try target chunks
yuvipanda Oct 29, 2022
d0608b2
ldsf
yuvipanda Oct 29, 2022
5d5e269
Simplify so recipe works for 1 region, 1 variable
yuvipanda Nov 9, 2022
3caff10
Create a zarr output per variable for hi
yuvipanda Nov 9, 2022
24eb1fb
Produce one recipe per region per variable
yuvipanda Nov 9, 2022
89971c7
Adopt recipe to use beam-refactor
yuvipanda Feb 17, 2023
cff9b83
Explicitly install required packages
yuvipanda Feb 17, 2023
9f70560
Generate all variables for na
yuvipanda Feb 17, 2023
de5b8ee
Use / as separator in subpath
yuvipanda Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions recipes/daymet/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
title: Daymet
description: >
Daily Surface Weather and Climatological Summaries (Daymet) provides
long-term, continuous, gridded estimates of daily weather and climatology
variables by interpolating and extrapolating ground-based observations through
statistical modeling techniques. The Daymet data products provide driver data
for biogeochemical terrestrial modeling and have myriad applications in many
Earth science, natural resource, biodiversity, and agricultural research
areas. Daymet weather variables include daily minimum and maximum temperature,
precipitation, vapor pressure, shortwave radiation, snow water equivalent, and
day length produced on a 1 km x 1 km gridded surface over continental North
America and Hawaii from 1980 and over Puerto Rico from 1950 through the end of
the most recent full calendar year.
pangeo_forge_version: '0.9.0'
pangeo_notebook_version: '2022.06.02'
recipes:
dict_object: recipe:recipes
provenance:
license: 'No constraints on data access or use.'
maintainers:
- name: 'Charles Stern'
orcid: '0000-0002-4078-0852'
github: cisaacstern
bakery:
id: 'pangeo-ldeo-nsf-earthcube'
51 changes: 51 additions & 0 deletions recipes/daymet/recipe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from pangeo_forge_recipes.patterns import pattern_from_file_sequence
from pangeo_forge_recipes.recipes import XarrayZarrRecipe
from pangeo_forge_cmr import get_cmr_granule_links

from pangeo_forge_recipes import patterns
import aiohttp
import netrc

# We need to provide EarthData credentials to fetch the files.
# The credentials of the currently logged in user are used, and passed on to the cloud
# as well when the operation is scaled out. This shall be automated with a machine identity
# in the future.
# go here to set up .netrc file: https://disc.gsfc.nasa.gov/data-access
username, _, password = netrc.netrc().authenticators('urs.earthdata.nasa.gov')
client_kwargs = {
'auth': aiohttp.BasicAuth(username, password),
'trust_env': True,
}

# Get the GPM IMERG Late Precipitation Daily data
shortname = 'Daymet_Daily_V4_1840'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "1840" here specific to daily - North America? And other regions will have different numerical IDs here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is daily, but all spatial areas are distributed under that DOI. The granule-level file name will distinguish the difference; na, pr, hi. We just updates and 1840 is now 2129. https://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=2129

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new short name: Daymet_Daily_V4R1_2129


all_files = get_cmr_granule_links(shortname)

var_files = {}

for f in all_files:
region, var, year = f.rsplit("/", 1)[1].rsplit(".", 1)[0].rsplit("_", 3)[1:]
var_files.setdefault(var, []).append(f)


print(var_files)

recipes = {}


for var in var_files:
# Use '-' not '_' to be valid dataflow name
recipes[var] = XarrayZarrRecipe(
pattern_from_file_sequence(
var_files[var],
# FIXME: Leap years?!
Copy link
Contributor

@TomAugspurger TomAugspurger Oct 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They just drop December 31st on leap years :)

concat_dim='time',
nitems_per_file=365,
fsspec_open_kwargs=dict(
client_kwargs=client_kwargs
),
),
inputs_per_chunk=1,
)