Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
89 changes: 89 additions & 0 deletions a08_qdm_may.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "39e0f601",
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"id": "7e124e2e",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 2,
"id": "44d3a33c",
"metadata": {},
"outputs": [],
"source": [
"forecast_qdm = xr.open_dataset(\"gs://poreallas-public-20260605/v20260731/parsed/forecast_adj.zarr\", engine = 'zarr', backend_kwargs = {\"storage_options\": {\"token\": \"anon\"}},)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e54dfb1c",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/emily_zuetell/git_projects/poreallas/.venv/lib/python3.14/site-packages/zarr/api/asynchronous.py:231: ZarrUserWarning: Consolidated metadata is currently not part in the Zarr format 3 specification. It may not be supported by other zarr implementations and may change in the future.\n",
" warnings.warn(\n"
]
},
{
"data": {
"text/plain": [
"<xarray.backends.zarr.ZarrStore at 0x7d967006cae0>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"forecast_qdm.to_zarr(\"forecast_qdm.zarr\", mode = \"w\", consolidated = True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cece8d92",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "poreallas-env (3.14.4.final.0)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
614 changes: 614 additions & 0 deletions analysis/a08_qdm_may.ipynb

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions analysis/isku_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def read_regions(uri: str) -> isku.GridWeightingRegions:
return regions

def grid_to_ir(data, savefile = None):
if 'longitude' in data.dims:
if data['longitude'].min() >= 0:
data = lon_adjust(data)
regions = read_regions(REGIONS_URI)
data_ir = isku.extract_regions(
data,
Expand All @@ -48,3 +51,10 @@ def grid_to_ir(data, savefile = None):
if savefile is not None:
data_ir.to_zarr(f"{savefile}.zarr")
return data_ir

def lon_adjust(_ds):
_ds["longitude"] = (_ds["longitude"] + 180) % 360 - 180
_ds = _ds.sortby("longitude")
_ds = _ds.rename({"longitude": "lon", "latitude": "lat"})
_ds = _ds.chunk("auto")
return _ds
Loading
Loading