{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "You will need to install the following packages:\n", "- `xarray`\n", "- `netcdf4`\n", "- `geemap`" ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "# %pip install geemap xarray netcdf4" ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "from ipyleaflet.velocity import Velocity\n", "import xarray as xr\n", "import geemap" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "center = [44.339565, -130.605468]\n", "zoom = 3\n", "m = geemap.Map(\n", " center=center,\n", " zoom=zoom,\n", " interpolation=\"nearest\",\n", " basemap=\"CartoDB.DarkMatter\",\n", " add_google_map=False,\n", " ee_initialize=False,\n", ")\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "url = \"https://github.com/gee-community/geemap/raw/master/examples/data/wind_global.nc\"\n", "geemap.download_file(url, \"wind_global.nc\")" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "ds = xr.open_dataset(\"wind_global.nc\")\n", "ds" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "display_options = {\n", " \"velocityType\": \"Global Wind\",\n", " \"displayPosition\": \"bottomleft\",\n", " \"displayEmptyString\": \"No wind data\",\n", "}\n", "wind = Velocity(\n", " data=ds,\n", " zonal_speed=\"u_wind\",\n", " meridional_speed=\"v_wind\",\n", " latitude_dimension=\"lat\",\n", " longitude_dimension=\"lon\",\n", " velocity_scale=0.01,\n", " max_velocity=20,\n", " display_options=display_options,\n", ")\n", "m.add_layer(wind)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.11.8" } }, "nbformat": 4, "nbformat_minor": 5 }