Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Jul 29, 2024
2 parents 9cb55d1 + c62f954 commit 653ddf6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ dependencies:
- zarr
- pip:
- git+https://github.com/bopen/c3s-eqc-automatic-quality-control.git@earthkit
- cacholote < 1.2.0
- cacholote != 1.2.0
- cgul
- kaleido
29 changes: 13 additions & 16 deletions notebooks/wp5/greenland_ice_velocity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"source": [
"import matplotlib.colors\n",
"import matplotlib.pyplot as plt\n",
"import xarray as xr\n",
"from c3s_eqc_automatic_quality_control import download\n",
"\n",
"plt.style.use(\"seaborn-v0_8-notebook\")"
Expand Down Expand Up @@ -140,22 +141,18 @@
"metadata": {},
"outputs": [],
"source": [
"ds = download.download_and_transform(\n",
" collection_id,\n",
" request,\n",
" chunks={\"period\": 1},\n",
" transform_func=mask_high_vel_and_compute_std,\n",
")\n",
"datasets = []\n",
"for period in request[\"period\"]:\n",
" ds = download.download_and_transform(\n",
" collection_id,\n",
" request | {\"period\": period},\n",
" )\n",
" datasets.append(\n",
" ds.squeeze(\"source\", drop=True).expand_dims(period=[period.replace(\"_\", \"-\")])\n",
" )\n",
"ds = xr.concat(datasets, \"period\")\n",
"ds = ds.chunk(y=1351, x=748)\n",
"\n",
"# Rename source dim\n",
"periods = []\n",
"for source in ds[\"source\"].values.tolist():\n",
" start, stop = source.split(\"_\")[5:7]\n",
" periods.append(f\"{start[:4]}-{stop[:4]}\")\n",
"ds[\"source\"] = periods\n",
"ds = ds.rename(source=\"period\")\n",
"\n",
"# Add attributes\n",
"for name, da in ds.data_vars.items():\n",
" if name == \"land_ice_surface_measurement_count\":\n",
Expand Down Expand Up @@ -344,7 +341,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -358,7 +355,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 653ddf6

Please sign in to comment.