|
98 | 98 | "%config InlineBackend.figure_format='retina'" |
99 | 99 | ] |
100 | 100 | }, |
101 | | - { |
102 | | - "cell_type": "code", |
103 | | - "execution_count": null, |
104 | | - "id": "3c4f6a4f-2584-40e9-bfb7-395914c07c71", |
105 | | - "metadata": {}, |
106 | | - "outputs": [], |
107 | | - "source": [ |
108 | | - "import zarr\n", |
109 | | - "import cf_xarray\n", |
110 | | - "import scipy\n", |
111 | | - "print('xr: ', xr.__version__)\n", |
112 | | - "print('dask: ', dask.__version__)\n", |
113 | | - "print('np: ', np.__version__)\n", |
114 | | - "print('zarr: ', zarr.__version__)\n", |
115 | | - "print('xvec: ', xvec.__version__)\n", |
116 | | - "print('cf xr: ', cf_xarray.__version__)\n", |
117 | | - "print('scipy: ', scipy.__version__)" |
118 | | - ] |
119 | | - }, |
120 | 101 | { |
121 | 102 | "cell_type": "code", |
122 | 103 | "execution_count": null, |
|
571 | 552 | "source": [ |
572 | 553 | "### 2) Visualize velocity data\n", |
573 | 554 | "\n", |
574 | | - "Xvec has a method, `to_geodataframe()` that allows us to easily convert the `xr.Dataset` vector cube to a `gpd.GeoDataFrame`. We can then use the GeoPandas `.explore()` method to interactively visualize the data." |
| 555 | + "Xvec has a method, `to_geodataframe()` that allows us to easily convert the `xr.Dataset` vector cube to a `gpd.GeoDataFrame`. We can then use the GeoPandas `.explore()` method to interactively visualize the data.\n", |
| 556 | + "\n", |
| 557 | + ":::{admonition} A note about working with image pair time series\n", |
| 558 | + "ITS_LIVE is an ice velocity time series where observations are derived from image pairs, meaning that an observation captures all movement that occurs between the two image acquisitions. In this tutorial, we focus on demonstrating the basics of dataset manipulation, examination and preliminary visualization; we index observations off of their mid-date and do not take the time between the images into account. For detailed time series analysis of ice velocity, this point should be considered when making decisions about which observations to include in analysis for different scientific objectives and how to perform aggregation and resampling operations. \n", |
| 559 | + "\n", |
| 560 | + "For a comprehensive approach to produce regularized ice velocity estimates from an ITS_LIVE time series, we direct the interested reader to {cite:t}`charrier_2025_TICOI`.\n", |
| 561 | + ":::" |
575 | 562 | ] |
576 | 563 | }, |
577 | 564 | { |
|
589 | 576 | "metadata": {}, |
590 | 577 | "outputs": [], |
591 | 578 | "source": [ |
| 579 | + "#Calculate mean over time dimension\n", |
592 | 580 | "vector_data_cube_mean = vector_data_cube.mean(dim=\"mid_date\")\n", |
593 | 581 | "\n", |
| 582 | + "#Calc speed\n", |
594 | 583 | "vector_data_cube_mean[\"vmag\"] = np.sqrt(vector_data_cube_mean[\"vx\"] ** 2 + vector_data_cube_mean[\"vy\"] ** 2)\n", |
595 | 584 | "\n", |
| 585 | + "#Visualize mean speed\n", |
596 | 586 | "vector_data_cube_mean[\"vmag\"].xvec.to_geodataframe(geometry=\"geometry\").explore(\"vmag\")" |
597 | 587 | ] |
598 | 588 | }, |
|
611 | 601 | "metadata": {}, |
612 | 602 | "outputs": [], |
613 | 603 | "source": [ |
| 604 | + "#Group by season and calculate mean\n", |
614 | 605 | "vector_cube_seasonal_mean = vector_data_cube.groupby(\"mid_date.season\").mean()\n", |
615 | 606 | "\n", |
| 607 | + "#Calc speed\n", |
616 | 608 | "vector_cube_seasonal_mean[\"vmag\"] = np.sqrt(vector_cube_seasonal_mean[\"vx\"] ** 2 + vector_cube_seasonal_mean[\"vy\"] ** 2)\n", |
617 | 609 | "\n", |
| 610 | + "#Plot summer mean\n", |
618 | 611 | "vector_cube_seasonal_mean.sel(season=\"JJA\")[\"vmag\"].xvec.to_geodataframe(geometry=\"geometry\").explore(\"vmag\")" |
619 | 612 | ] |
620 | 613 | }, |
|
0 commit comments