-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
88 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import json | ||
|
||
import fsspec | ||
import tqdm | ||
from kerchunk.combine import MultiZarrToZarr | ||
from kerchunk.hdf import SingleHdf5ToZarr | ||
|
||
fs = fsspec.filesystem("s3", anon=True) | ||
|
||
pattern = "s3://nsf-ncar-era5/e5.oper.an.pl/202403/e5.oper.an.pl.*.ll025sc.2024????00_2024????23.nc" | ||
|
||
|
||
jsons = [] | ||
|
||
for file in tqdm.tqdm(fs.glob(pattern)): | ||
with fs.open(file, "rb", anon=True) as f: | ||
h5chunks = SingleHdf5ToZarr(f, file) | ||
jsons.append(h5chunks.translate()) | ||
|
||
|
||
mzz = MultiZarrToZarr( | ||
jsons, | ||
remote_protocol="s3", | ||
remote_options={"anon": True}, | ||
concat_dims=["time"], | ||
identical_dims=["latitude", "longitude"], | ||
) | ||
|
||
with open("combined.json", "w") as f: | ||
json.dump(mzz.translate(), f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
################# | ||
xarray-kerchunk | ||
################# | ||
|
||
.. literalinclude:: xarray-kerchunk.yaml | ||
:language: yaml | ||
|
||
The code below is inspired by the `kerchunk tutorial`_, and makes use of | ||
a subset of the `ERA5 dataset available on AWS`_. You may need to | ||
install the relevant packages before running the code below. | ||
|
||
.. literalinclude:: xarray-kerchunk.py | ||
:language: python | ||
|
||
.. _era5 dataset available on aws: https://registry.opendata.aws/ecmwf-era5/ | ||
|
||
.. _kerchunk tutorial: https://fsspec.github.io/kerchunk/tutorial.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
dates: | ||
start: 2024-03-24T00:00:00 | ||
end: 2024-03-24T03:00:00 | ||
frequency: 1h | ||
|
||
input: | ||
xarray-kerchunk: | ||
json: combined.json | ||
param: T | ||
level: [1000, 50] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
############# | ||
xarray-zarr | ||
############# | ||
|
||
.. literalinclude:: xarray-zarr.yaml | ||
:language: yaml |
2 changes: 1 addition & 1 deletion
2
docs/building/sources/xarray.yaml → docs/building/sources/xarray-zarr.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
input: | ||
xarray: | ||
xarray-zarr: | ||
url: https://... |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
######## | ||
zenodo | ||
######## | ||
|
||
https://zenodo.org/records/6470725 | ||
|
||
.. literalinclude:: zenodo.yaml | ||
:language: yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dates: | ||
start: 2021-06-28 | ||
end: 2021-06-29 | ||
|
||
input: | ||
zenodo: | ||
record_id: 6470725 | ||
file_key: "{param}_INCA_202106280700.nc" | ||
param: [RR,PN, PT] |
This file was deleted.
Oops, something went wrong.