{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "\"Open\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) if needed." ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "# !pip install geemap" ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "import os\n", "import geemap\n", "import xarray as xr\n", "from ipyleaflet import basemaps\n", "from ipyleaflet.velocity import Velocity" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map(center=[44.33, -130.60], zoom=3, interpolation=\"nearest\")\n", "Map.add_layer(basemaps.CartoDB.DarkMatter)\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "file_path = os.path.abspath(\"wind_global.nc\")\n", "if not os.path.exists(file_path):\n", " url = \"https://github.com/gee-community/geemap/raw/master/examples/data/wind_global.nc\"\n", " geemap.download_file(url)" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "ds = xr.open_dataset(file_path)\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", " name=\"Velocity\",\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", "Map.add_layer(wind)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }