5 "execution_count": null,
6 "id": "cd28b796-4661-4a6a-a84e-14fcba89fe83",
12 "from herbie.core import Herbie\n",
13 "from toolbox.gridded_data import pluck_points\n",
14 "import pandas as pd\n",
19 "cell_type": "markdown",
20 "id": "6b7f5da2-a58c-48f5-99ee-59cd8f08bd12",
23 "## Gather Herbie Example\n",
25 "Get HRRR data vars at one time period for list of coordinates. Coords are from the RAWS stations in WA state with complete fmda vars."
30 "execution_count": null,
31 "id": "071d8d7e-6164-4934-900a-8cae98c91e38",
37 "# Read in list of RAWS Stations\n",
38 "df = pd.read_csv(\"raws_stations_WA.csv\")\n",
40 "# Filter to those with complete fmda data\n",
41 "df = df[(df[['air_temp', 'relative_humidity', 'precip_accum',\n",
42 " 'fuel_moisture', 'wind_speed', 'solar_radiation']]==1).sum(axis=1)==6]\n",
44 "# Get list of coords\n",
45 "points = list(df[[\"lon\",\"lat\"]].itertuples(index=False,name=None))\n",
46 "names = np.unique(df['STID'])\n",
52 "cell_type": "markdown",
53 "id": "59ebbf15-a92f-40c9-a181-ddfcd1c5e3ec",
61 "execution_count": null,
62 "id": "1d7063e3-619a-40dd-9048-d79d52b7d244",
69 " \"2022-06-01-08:00\",\n",
75 "cell_type": "markdown",
76 "id": "edc502bb-9e86-4dec-b8aa-07468a38bf73",
79 "For each variable, pluck points at location.\n",
81 "https://www.nco.ncep.noaa.gov/pmb/products/hrrr/hrrr.t00z.wrfsfcf00.grib2.shtml"
85 "cell_type": "markdown",
86 "id": "a1326a02-605a-45ed-8710-cde55093f15f",
89 "HOW TO: xarray all variables below at once? The obvious ways break."
94 "execution_count": null,
95 "id": "b2dc91a9-afd4-45a7-b14b-5fd06f038c3d",
106 "execution_count": null,
107 "id": "441b87b9-e453-40c6-9621-d708d1da3c1a",
111 "ds = H.xarray(\"(?:TMP|RH):2 m\", remove_grib=False)\n",
112 "dsi = ds.herbie.nearest_points(\n",
120 "execution_count": null,
121 "id": "7f381b60-502b-4539-8b6f-5f26222a2ec6",
129 "cell_type": "markdown",
130 "id": "7497648c-9d71-40cc-998d-20ef93704758",
133 "## FastHerbie for Multiple Times"
138 "execution_count": null,
139 "id": "eb96adc9-f33d-48f5-8477-d4bbca0fb278",
143 "from herbie import FastHerbie\n",
144 "import pandas as pd"
149 "execution_count": null,
150 "id": "63da6b04-7f10-40cb-8701-08cc5a777e89",
156 "# Create a range of dates, June 1 to June 30\n",
157 "dates = pd.date_range(\n",
158 " start=\"2022-06-01 00:00\",\n",
166 "execution_count": null,
167 "id": "26b4cd8c-1b16-4134-ba35-15a2eb5018c4",
178 "execution_count": null,
179 "id": "76b013be-3b41-47a6-acf1-634935cb37f6",
185 "# Make FastHerbie Object.\n",
186 "fh = FastHerbie(dates, model=\"hrrr\")"
191 "execution_count": null,
192 "id": "89b0dba3-7a1b-4f38-96a3-e590d3ff4603",
203 "execution_count": null,
204 "id": "8336e98b-fc7c-4ce5-8c87-a203659ebe25",
210 "ds = fh.xarray(\"(?:TMP|RH):2 m\", remove_grib=False)\n",
211 "dsi = ds.herbie.nearest_points(\n",
212 " points=points[0],\n",
219 "id": "e74374e7-32af-4201-816c-a0c198b2c38b",
228 "cell_type": "markdown",
229 "id": "59ddb9ba-d0d9-44fe-9173-ce3b1911e1bc",
232 "## Manually with PyDAP"
237 "id": "f3203cf1-a2bc-4934-b09b-c28ca1236f96",
243 "execution_count": null,
244 "id": "593668b5-37c6-46dc-a2ce-78cfe4c878de",
252 "display_name": "Python 3 (ipykernel)",
253 "language": "python",
261 "file_extension": ".py",
262 "mimetype": "text/x-python",
264 "nbconvert_exporter": "python",
265 "pygments_lexer": "ipython3",