Skip to content

Commit 8f66849

Browse files
authored
Merge pull request #9 from ProjectPythia/main
updates
2 parents 1f5d34b + b316534 commit 8f66849

File tree

5 files changed

+1157
-233
lines changed

5 files changed

+1157
-233
lines changed

environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ dependencies:
1616
- h5netcdf
1717
- pip
1818
- pip:
19-
- global-land-mask
19+
- global-land-mask
20+
- visualkeras

notebooks/JS2_S3_example.ipynb

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "dca900b4-b5ef-479d-847c-2c43bcf8e497",
6+
"metadata": {},
7+
"source": [
8+
"# Read in data from the S3 bucket"
9+
]
10+
},
11+
{
12+
"cell_type": "markdown",
13+
"id": "bd5d50d2-2af2-4f50-9935-bda6ddebe7b2",
14+
"metadata": {},
15+
"source": [
16+
"---"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"id": "4c7d47c8-1be7-4654-85dc-d88cf8979333",
22+
"metadata": {},
23+
"source": [
24+
"## Imports"
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": null,
30+
"id": "f7604cb4-59ec-4068-adeb-b79aadb50db7",
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"import xarray as xr\n",
35+
"import s3fs"
36+
]
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"id": "69df2c27-18d0-47d5-86da-e231e39ef789",
41+
"metadata": {},
42+
"source": [
43+
"## Loading our data into xarray\n",
44+
"First, let's open a single file.\n",
45+
"\n",
46+
"Our data is stored in the cloud on Jetstream2. We'll load in one of the NetCDF files, recast it from an s3 `fsspec` object into something that `xarray` can open, and then open and examine the dataset."
47+
]
48+
},
49+
{
50+
"cell_type": "code",
51+
"execution_count": null,
52+
"id": "ed825e8d-407d-4b72-93fc-85ef1de1b815",
53+
"metadata": {},
54+
"outputs": [],
55+
"source": [
56+
"jetstream_url = 'https://js2.jetstream-cloud.org:8001/'\n",
57+
"\n",
58+
"s3 = s3fs.S3FileSystem(anon=True, client_kwargs=dict(endpoint_url=jetstream_url))\n",
59+
"\n",
60+
"s3path = 's3://pythia/ml-hurricane-intensity/final_proc_5yr_6h.nc'\n",
61+
"\n",
62+
"# Open all files from folder\n",
63+
"s3file = s3.open(s3path)\n",
64+
"\n",
65+
"# Open with xarray\n",
66+
"ds = xr.open_dataset(s3file)\n"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": null,
72+
"id": "31a8cc52-b063-49a9-ab4a-967097f5a9b6",
73+
"metadata": {},
74+
"outputs": [],
75+
"source": [
76+
"ds"
77+
]
78+
}
79+
],
80+
"metadata": {
81+
"kernelspec": {
82+
"display_name": "Local Turing Environment (Testing Only!)",
83+
"language": "python",
84+
"name": "local"
85+
},
86+
"language_info": {
87+
"codemirror_mode": {
88+
"name": "ipython",
89+
"version": 3
90+
},
91+
"file_extension": ".py",
92+
"mimetype": "text/x-python",
93+
"name": "python",
94+
"nbconvert_exporter": "python",
95+
"pygments_lexer": "ipython3",
96+
"version": "3.13.5"
97+
}
98+
},
99+
"nbformat": 4,
100+
"nbformat_minor": 5
101+
}

0 commit comments

Comments
 (0)