Skip to content

Commit

Permalink
add finished image to sea level rise
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Dec 11, 2023
1 parent 5fff845 commit b136144
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
Binary file added images/sea-level-rise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 29 additions & 6 deletions sea-level-rise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a1dd16b6-c5bb-4d40-a9f4-d3d60e44cd2c",
"metadata": {},
"outputs": [],
"source": [
"granules[0]"
]
},
{
"cell_type": "markdown",
"id": "64df6beb-e1e9-4691-b6ec-18dfa6803f53",
Expand All @@ -69,14 +79,15 @@
"import coiled\n",
"import xarray as xr\n",
"\n",
"@coiled.function(region=\"us-west-2\") # Same region as data\n",
"@coiled.function(\n",
" region=\"us-west-2\", # Same region as data\n",
")\n",
"def process(granule, fs):\n",
" results = []\n",
" for file in granule.data_links(\"direct\"):\n",
" ds = xr.open_dataset(fs.open(file))\n",
" ds = ds.sel(Latitude=slice(23, 50), Longitude=slice(270, 330))\n",
" ds = ds.SLA.where((ds.SLA >= 0) & (ds.SLA < 10))\n",
" results.append(ds)\n",
" results.append(ds.SLA)\n",
" result = xr.concat(results, dim=\"Time\")\n",
" return result"
]
Expand Down Expand Up @@ -139,13 +150,25 @@
"ds = xr.concat(chunks, dim=\"Time\")\n",
"ds.std(\"Time\").plot(x=\"Longitude\", y=\"Latitude\", figsize=(14, 6));"
]
},
{
"cell_type": "markdown",
"id": "85112fb8-130c-4134-b38e-2b7dc92b3840",
"metadata": {},
"source": [
"## Finished result\n",
"\n",
"The variance of sea level altitude over time\n",
"\n",
"![](images/sea-level-rise.png)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python [conda env:coiled]",
"language": "python",
"name": "python3"
"name": "conda-env-coiled-py"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -157,7 +180,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down

0 comments on commit b136144

Please sign in to comment.