{ "cells": [ { "cell_type": "markdown", "metadata": { "cell_marker": "\"\"\"" }, "source": [ "# Climate Data from GridMET" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-11-12T23:05:08.325945Z", "iopub.status.busy": "2021-11-12T23:05:08.325171Z", "iopub.status.idle": "2021-11-12T23:05:09.703892Z", "shell.execute_reply": "2021-11-12T23:05:09.704334Z" } }, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "import matplotlib.pyplot as plt\n", "\n", "import pygridmet as gridmet\n", "from pygridmet import GridMET\n", "from pynhd import NLDI" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The Daymet database provides climatology data at 1-km resolution. First, we use [PyNHD](https://github.com/hyriver/pynhd) to get the contributing watershed geometry of a NWIS station with the ID of `USGS-01318500`:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2021-11-12T23:05:09.708922Z", "iopub.status.busy": "2021-11-12T23:05:09.708051Z", "iopub.status.idle": "2021-11-12T23:05:10.262066Z", "shell.execute_reply": "2021-11-12T23:05:10.262509Z" } }, "outputs": [], "source": [ "geometry = NLDI().get_basins(\"01318500\").geometry.iloc[0]" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "[PyGridMET](https://github.com/hyriver/pygridmet) allows us to get the data for a single pixel or for a region as gridded data. The function to get single pixel is called `pygridmet.get_bycoords` and for gridded data is called `pygridmet.get_bygeom`. The arguments of these functions are identical except the first argument where the latter\n", "should be polygon and the former should be a coordinate (a tuple of length two as in `(x, y)`).\n", "\n", "The input geometry or coordinate can be in any valid CRS (defaults to EPSG:4326). The `date`\n", "argument can be either a tuple of length two like `(start_str, end_str)` or a list of years\n", "like `[2000, 2005]`.\n", "\n", "We can get a dataframe of available variables and their info by calling `GridMET().gridmet_table`." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | variable | \n", "abbr | \n", "long_name | \n", "units | \n", "
---|---|---|---|---|
0 | \n", "Precipitation | \n", "pr | \n", "precipitation_amount | \n", "mm | \n", "
1 | \n", "Maximum Relative Humidity | \n", "rmax | \n", "daily_maximum_relative_humidity | \n", "% | \n", "
2 | \n", "Minimum Relative Humidity | \n", "rmin | \n", "daily_minimum_relative_humidity | \n", "% | \n", "
3 | \n", "Specific Humidity | \n", "sph | \n", "daily_mean_specific_humidity | \n", "kg/kg | \n", "
4 | \n", "Surface Radiation | \n", "srad | \n", "daily_mean_shortwave_radiation_at_surface | \n", "W/m2 | \n", "
5 | \n", "Wind Direction | \n", "th | \n", "daily_mean_wind_direction | \n", "Degrees clockwise from north | \n", "
6 | \n", "Minimum Air Temperature | \n", "tmmn | \n", "daily_minimum_temperature | \n", "K | \n", "
7 | \n", "Maximum Air Temperature | \n", "tmmx | \n", "daily_maximum_temperature | \n", "K | \n", "
8 | \n", "Wind Speed | \n", "vs | \n", "daily_mean_wind_speed | \n", "m/s | \n", "
9 | \n", "Burning Index | \n", "bi | \n", "daily_mean_burning_index_g | \n", "- | \n", "
10 | \n", "Fuel Moisture (100-hr) | \n", "fm100 | \n", "dead_fuel_moisture_100hr | \n", "% | \n", "
11 | \n", "Fuel Moisture (1000-hr) | \n", "fm1000 | \n", "dead_fuel_moisture_1000hr | \n", "% | \n", "
12 | \n", "Energy Release Component | \n", "erc | \n", "daily_mean_energy_release_component-g | \n", "- | \n", "
13 | \n", "Reference Evapotranspiration (Alfalfa) | \n", "etr | \n", "daily_mean_reference_evapotranspiration_alfalfa | \n", "mm | \n", "
14 | \n", "Reference Evapotranspiration (Grass) | \n", "pet | \n", "daily_mean_reference_evapotranspiration_grass | \n", "mm | \n", "
15 | \n", "Vapor Pressure Deficit | \n", "vpd | \n", "daily_mean_vapor_pressure_deficit | \n", "kPa | \n", "