Skip to content

Commit

Permalink
update conus404 explore instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
amsnyder committed May 28, 2024
1 parent 897bb53 commit a3d1dfb
Show file tree
Hide file tree
Showing 101 changed files with 22,391 additions and 70,555 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: dea04435187e365e017cf456b70ee111
config: abd3ddd4b6ad8bb366467d48a3bc9429
tags: 645f666f9bcd5a90fca523b33c5a78b7
1 change: 0 additions & 1 deletion .ipynb_checkpoints/index-checkpoint.html

This file was deleted.

39 changes: 0 additions & 39 deletions _downloads/18da692517bdcb499ad9638aeab068b2/jupter-start.sh

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 0 additions & 19 deletions _sources/dataset_access/README.md

This file was deleted.

47 changes: 32 additions & 15 deletions _sources/dataset_access/conus404_explore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
"id": "57354df2-6786-4d1d-859e-1d5099cb85b9",
"metadata": {},
"source": [
"## 1) Open dataset from Intake Catalog\n",
"* Select `on-prem` dataset from /caldera if running on prem (Denali/Tallgrass)\n",
"* Select `cloud`/`osn` object store data if running elsewhere"
"## 1) Select the Dataset from HyTEST's Intake Catalog"
]
},
{
Expand All @@ -61,6 +59,14 @@
"list(cat)"
]
},
{
"cell_type": "markdown",
"id": "b7cdd988-4d56-49a5-85b4-d5d81c3db89d",
"metadata": {},
"source": [
"**Select a dataset**: If you are unsure of which copy of a particular dataset to use (e.g. `conus404-hourly-?`), please review the [HyTEST JupyterBook](https://hytest-org.github.io/hytest/dataset_catalog/README.html#storage-locations)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -80,7 +86,7 @@
"source": [
"## 2) Set Up AWS Credentials (Optional)\n",
"\n",
"This notebook reads data from the OSN pod by default, which is object store data on a high speed internet connection that is free to access from any environment. If you change this notebook to use one of the CONUS404 datasets stored on S3 (options ending in `-cloud`), you will be pulling data from a `requester-pays` S3 bucket. This means you have to set up your AWS credentials, else we won't be able to load the data. Please note that reading the `-cloud` data from S3 may incur charges if you are reading data outside of the us-west-2 region or running the notebook outside of the cloud altogether. If you would like to access one of the `-cloud` options, uncomment and run the following code snippet to set up your AWS credentials. You can find more info about this AWS helper function [here](../environment_set_up/Help_AWS_Credentials.md)."
"This notebook reads data from the OSN pod. The OSN pod is object store data on a high speed internet connection with free access from any computing environment. If you change this notebook to use one of the CONUS404 datasets stored on S3 (options ending in `-cloud`), you will be pulling data from a `requester-pays` S3 bucket. This means you have to set up your AWS credentials before you are able to load the data. Please note that reading the `-cloud` data from S3 may incur charges if you are reading data outside of AWS's `us-west-2` region or running the notebook outside of the cloud altogether. If you would like to access one of the `-cloud` options, uncomment and run the following code snippet to set up your AWS credentials. You can find more info about this AWS helper function [here](../environment_set_up/Help_AWS_Credentials.ipynb)."
]
},
{
Expand All @@ -100,9 +106,9 @@
"id": "ecef85f6-01e4-4d84-9cce-0bf409b30637",
"metadata": {},
"source": [
"## 3) Parallelize with Dask \n",
"## 3) Parallelize with Dask (Optional, but recommended)\n",
"Some of the steps we will take are aware of parallel clustered compute environments\n",
"using `dask`. We're going to start a cluster now so that future steps can take advantage\n",
"using `dask`. We will start a cluster so that future steps can take advantage\n",
"of this ability. \n",
"\n",
"This is an optional step, but speed ups data loading significantly, especially \n",
Expand All @@ -120,7 +126,7 @@
},
"outputs": [],
"source": [
"%run ../environment_set_up/Start_Dask_Cluster_Nebari.ipynb\n",
"#%run ../environment_set_up/Start_Dask_Cluster_Nebari.ipynb\n",
"## If this notebook is not being run on Nebari/ESIP, replace the above \n",
"## path name with a helper appropriate to your compute environment. Examples:\n",
"# %run ../environment_set_up/Start_Dask_Cluster_Denali.ipynb\n",
Expand All @@ -144,9 +150,19 @@
"metadata": {},
"outputs": [],
"source": [
"# read in the dataset and use metpy to parse the crs information on the dataset\n",
"print(f\"Reading {dataset} metadata...\", end='')\n",
"ds = cat[dataset].to_dask().metpy.parse_cf()\n",
"print(\"done\")\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4487472f-99fd-4bfa-98b5-742f8d935feb",
"metadata": {},
"outputs": [],
"source": [
"# Examine the grid data structure for SNOW: \n",
"ds.SNOW"
]
Expand All @@ -156,8 +172,7 @@
"id": "235352e6-face-431f-932b-2f65e0e6beaf",
"metadata": {},
"source": [
"Looks like this dataset is organized in three coordinates (x, y, and time). There is a\n",
"`metpy_crs` attached:"
"Looks like this dataset is organized in three coordinates (x, y, and time), and we have used the `metpy` package to pase the crs information into the `metpy_crs` variable:"
]
},
{
Expand Down Expand Up @@ -215,10 +230,10 @@
"id": "8dd35652-608d-4eca-94d9-78cfd3591b38",
"metadata": {},
"source": [
"**SIDE NOTE**\n",
"To identify a point, we will start with its lat/lon coordinates. But the\n",
"data is in Lambert Conformal Conic... need to re-project/transform using the\n",
"built-in `crs` we examined earlier: "
"We will identify a point that we want to pull data for using lat/lon coordinates.\n",
"\n",
"The CONUS404 data is in a Lambert Conformal Conic projection, so we need to re-project/transform using the\n",
"built-in `crs` we examined earlier."
]
},
{
Expand All @@ -240,6 +255,7 @@
"metadata": {},
"outputs": [],
"source": [
"# pull out a particulat time slice at the specified coordinates\n",
"%%time\n",
"da = ds.PREC_ACC_NC.sel(x=x, y=y, method='nearest').sel(time=slice('2013-01-01 00:00','2013-12-31 00:00')).load()"
]
Expand All @@ -251,6 +267,7 @@
"metadata": {},
"outputs": [],
"source": [
"# plot your time series\n",
"da.hvplot(x='time', grid=True)"
]
},
Expand Down Expand Up @@ -291,7 +308,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.11.8"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
4 changes: 2 additions & 2 deletions _sources/dataset_access/conus404_regrid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
"outputs": [],
"source": [
"# you will need to update the filepaths and uncomment the following line to save out your data.\n",
"# ds_out.to_netcdf(nc_outfile, encoding=encoding, mode='w')"
"# ds_out.load().to_netcdf(nc_outfile, encoding=encoding, mode='w')"
]
},
{
Expand Down Expand Up @@ -444,7 +444,7 @@
"outputs": [],
"source": [
"# you will need to update the filepaths and uncomment the following line to save out your data.\n",
"# ds_outcl.to_netcdf('CONUS404_DRB_curvilinear.nc', encoding=encoding, mode='w')"
"# ds_outcl.load().to_netcdf('CONUS404_DRB_curvilinear.nc', encoding=encoding, mode='w')"
]
},
{
Expand Down
18 changes: 4 additions & 14 deletions _sources/dataset_access/conus404_spatial_aggregation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"outputs": [],
"source": [
"## Select the dataset you want to read into your notebook and preview its metadata\n",
"dataset = 'conus404-daily-cloud' \n",
"dataset = 'conus404-daily-osn' \n",
"cat[dataset]"
]
},
Expand Down Expand Up @@ -164,7 +164,7 @@
"metadata": {},
"outputs": [],
"source": [
"ds = cat['conus404-daily-cloud'].to_dask()"
"ds = cat['conus404-daily-osn'].to_dask()"
]
},
{
Expand Down Expand Up @@ -195,7 +195,7 @@
"gage_id = '01482100'\n",
"nldi = NLDI()\n",
"del_basins = nldi.get_basins(gage_id)\n",
"huc12_basins = WaterData('huc12').bygeom(del_basins.geometry[0])"
"huc12_basins = WaterData('wdb12').bygeom(del_basins.geometry[0])"
]
},
{
Expand Down Expand Up @@ -568,16 +568,6 @@
"overlay.geometry.area.groupby(overlay[region_name]).sum().nlargest(10)/1e6 # km2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db635849-5077-457f-b8f2-7b1e49391154",
"metadata": {},
"outputs": [],
"source": [
"overlay[overlay[region_name] == \"Delaware Bay-Deep\"].geometry.plot(edgecolor='k', aspect='equal')"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -843,7 +833,7 @@
"metadata": {},
"outputs": [],
"source": [
"ds_var = var_regridded.sel(name=['Delaware Bay-Deep', 'Black Creek']).resample(time=\"MS\").mean().to_dataset(region_name)"
"ds_var = var_regridded.sel(name=['Mallory Brook-West Branch Delaware River', 'Yaleville Brook-Susquehanna River']).resample(time=\"MS\").mean().to_dataset(region_name)"
]
},
{
Expand Down
Loading

0 comments on commit a3d1dfb

Please sign in to comment.