diff --git a/book/tutorials/snowex-core/01_snowex_data_overview.ipynb b/book/tutorials/snowex-core/01_snowex_data_overview.ipynb
index c1998e4..f740d99 100644
--- a/book/tutorials/snowex-core/01_snowex_data_overview.ipynb
+++ b/book/tutorials/snowex-core/01_snowex_data_overview.ipynb
@@ -57,8 +57,8 @@
"| **Year** | **Campaign Type** | **Measurement Focus** |\n",
"| :----------- | :--------- |:------------------- |\n",
"| 2017 | IOP | Colorado, focused on multiple instruments in a forest gradient. |\n",
- "| 2020 | IOP, TS | Western US, focused on Time Series of L-band InSAR, active/passive microwave for SWE and thermal IR for snow surface temp.|\n",
- "| 2021 | TS | Western US, continued Time Series of L-band InSAR, also addressed prairie & snow albedo questions. |\n",
+ "| 2020 | IOP, TS | Western U.S focused on Time Series of L-band InSAR, active/passive microwave for SWE and thermal IR for snow surface temp.|\n",
+ "| 2021 | TS | Western U.S, continued Time Series of L-band InSAR, also addressed prairie & snow albedo questions. |\n",
"| 2023 | IOP | Alaska Tundra & Boreal forest, focused on addressing SWE/snow depth and albedo objectives. |\n",
"\n",
"\n",
@@ -72,7 +72,7 @@
"metadata": {},
"source": [
"### Where has SnowEx Been?\n",
- "Campaign efforts are focused on various snow climates in the Western United States. SnowEx partnerships and expertise are spread across the U.S and international.\n",
+ "Campaign efforts are focused on various snow climates in the western United States. SnowEx partnerships and expertise are spread across the U.S and international.\n",
" \n",
"![](./content/01_snowex-map.png)\n",
"**Figure 1.** Map showing the locations of SnowEx field campaign areas (red dot). Base map shows snow classes defined in [Sturm and Liston, 2021](https://journals.ametsoc.org/view/journals/hydr/22/11/JHM-D-21-0070.1.xml). The snow pit images show a representative pit in each of the class types visited by SnowEx. "
diff --git a/book/tutorials/snowex-core/02_snowex_data_descriptions.ipynb b/book/tutorials/snowex-core/02_snowex_data_descriptions.ipynb
index 499c892..2dc97f5 100644
--- a/book/tutorials/snowex-core/02_snowex_data_descriptions.ipynb
+++ b/book/tutorials/snowex-core/02_snowex_data_descriptions.ipynb
@@ -8,7 +8,7 @@
"# Data Descriptions\n",
"(10 minutes)\n",
"\n",
- "Campaigns are participant driven and produce community wide data. Without our vast community, we wouldn't have the robust ground-based observations that are part of the SnowEx collection. See the ground-based calibration and validation measurements central to the SnowEx field campaigns."
+ "Campaigns are participant driven and produce community wide data. Without our vast community, we wouldn't have the robust ground-based observations that are part of the SnowEx collection. Discover the ground-based calibration and validation measurements central to the SnowEx field campaigns. Collecting in situ measurements require hours of manual labor and attention to detail. While observers adhere to standard protocols, they often rely on their best judgment and collective expertise when facing challenging sampling conditions."
]
},
{
@@ -33,21 +33,22 @@
"### What ground-based data sets are central for snow field campaigns? \n",
"\n",
"![](./content/02_measurement-types.png)\n",
- "**Figure 1.** Ground-based measurements central to the SnowEx campaigns. (Left to Right panels) 1). Depth Transects: Observer uses the MagnaProbe to measure snow depths.\n",
- "2). Snow Pit: Vertical density cuts show the dual profile sampling protocol. 3). Interval Board/SWE Tube: Overnight snow being measured in a snow tube to record the daily change during the IOP campaign. 4). Specific Surface Area (SSA) being collected at a shallow tundra snow pit with the IceCube. 5). SnowMicroPen (SMP) penatrating the snowpack to record snow stratigraphy over a range of intervals (10-50m) away from the centralized snow pit.\n",
+ "**Figure 1.** Ground-based measurements central to the SnowEx campaigns. (Left to Right panels) 1). **Depth Transects**: Observer uses the MagnaProbe to measure snow depths.\n",
+ "2). **Snow Pit**: Vertical density cuts show the dual profile sampling protocol. 3). **Interval Board/SWE Tube**: Overnight snow being measured in a snow tube to record the daily change during the IOP campaign. 4). **Specific Surface Area (SSA)** being collected at a shallow tundra snow pit with the IceCube. 5). **SnowMicroPen (SMP)** penatrating the snowpack to record snow stratigraphy over a range of intervals (10-50m) away from the centralized snow pit.\n",
"\n",
+ "### Additional detail on depth transects and snow pit sampling procedures\n",
+ "**Depth Transects**\\\n",
"Here you can see a summary of some of the depth sampling patterns you might discover in the snow depth data sets. Typically the pattern is a result of what instrument collection technique is deployed. \n",
"\n",
"![](./content/02_depth_spirals.png)\n",
"\n",
- "**Figure 2.** Examples of snow depth measurements taken in different spatial patterns, representing different spatial extents. a). shows pit-depth, square-depths with L-depths from one of the plots. b). captures spiral-depths collected using a MagnaProbe. c). Includes spiral-depths and a single transect, ~10km in total length. Note the difference in scale across each panel. Background images are courtesy of @ 2020 Maxar Technologies Inc., Alaska Geospatial Office, USGS. \n",
- "\n",
+ "**Figure 2.** Examples of snow depth measurements taken in different spatial patterns, representing different spatial extents. a). shows pit-depth, square-depths with L-depths from a study plot. b). captures spiral-depths collected using a MagnaProbe. c). Includes spiral-depths and a single transect, ~10km in total length. Note the difference in scale across each panel. Background images are courtesy of @ 2020 Maxar Technologies Inc., Alaska Geospatial Office, USGS. \n",
"\n",
+ "**Snow Pits**\\\n",
"There are a lot of measurements in a single snow pit. This diagram helps explain what all is measured at a snow pit. \n",
"\n",
"![](./content/02_pit-parameters.png)\n",
"**Figure 3.** Description of parameters that come from a single snow pit visit. The colored ovals on the images correspond to the colored measurements on the left side.\n",
- "\n",
"_____"
]
},
@@ -62,7 +63,7 @@
"\n",
"![](./content/02_matrix.png)\n",
"**Figure 4.** Nine-member snow and vegetation matrix used to sample and name snow pits during the Grand Mesa IOP campaign \n",
- " \n",
+ "\n",
"**Vegetation Classes**\n",
"- 1-3 = treeless (0% tree cover)\n",
"- 4-6 = sparse (1-30% tree cover)\n",
@@ -70,7 +71,7 @@
"\n",
"**Snow Depth Classes**\n",
"- 1, 4, 7 = shallow (<90cm)\n",
- "- 2, 5, 8 = medium (90-122cm)\n",
+ "- 2, 5, 8 = medium (90-122cm\n",
"- 3, 6, 9 = deep (>122cm)\n",
"\n",
"**Flight Lines**\n",
@@ -78,13 +79,10 @@
"- 'N' = North\n",
"- 'S' = South\n",
" \n",
- "\n",
- "\n",
"![](./content/02_GMpitMap.jpg)\n",
"\n",
- "**Figure 5.** Grand Mesa IOP 2020 sampling design. The rectangles are the lidar, UAVSAR, SWESARR, Thermal IR, and Gamma flight lines. The point markers are the locations of snow pits. \n",
- "___\n",
- "\n"
+ "**Figure 5.** Grand Mesa, Colorado IOP 2020 sampling design. The rectangles are the SWESAR, UAVSAR, Thermal IR, and Gamma flight lines. The point markers are the locations of snow pits. \n",
+ "___"
]
},
{
@@ -158,7 +156,7 @@
"\n",
"Note - If a site was repeated (e.g. Cameron Pass, Michigan River) then the Pit Count column is the sum of the observations for two years). The Snow Class column was extracted from the 300 m Snow Classification data set (Liston, 2021 and can be accessed [here](https://nsidc.org/data/NSIDC-0768/versions/1) at NSIDC). See the previous notebook to characterize the Snow Classes. \n",
"\n",
- "This table can be accessed as a geojson from [Megan's github gists](https://gist.github.com/meganmason/dde13c46a90875e364b1c25a31bff1d8) \n",
+ "This table can be accessed as a geojson from [Megan's github gists](https://gist.github.com/meganmason/dde13c46a90875e364b1c25a31bff1d8)\n",
"\n",
"To use this as a geojson in your project:\n",
"1. Navigate to the link above\n",
@@ -191,46 +189,47 @@
"metadata": {},
"source": [
"___\n",
- "### III: Arctic Tundra and Boreal Forest, Alaska\n",
- "\n",
- "\n",
+ "### III: Arctic Tundra and Boreal Forest, Alaska IOP\n",
"\n",
"![](./content/02_ak-sites.png)\n",
"\n",
- "**Figure 6.** SnowEx 2023 site locations in Interior Alaska and on the North Slope of Alaska. The flight lines for SWESARR (turquoise areas) and lidar/stereo (red boxes). SWE/snow depth measurement periods studied 5 locations: 3 in the boreal forest and 2 in the arctic tundra. The albedo/snow melt campaign period studied 3 sites in the boreal forest.\n",
+ "**Figure 6.** SnowEx 2023 site locations in Interior Alaska (boreal forest) and on the North Slope (tundra) of Alaska. The flight lines for SWESARR (turquoise areas) and lidar/stereo (red boxes). SWE/snow depth measurement periods studied five locations: three in the boreal forest and two in the arctic tundra. The albedo/snow melt campaign period studied three sites in the boreal forest.\n",
"\n",
"#### SWE/snow depth focused campaign (Oct 2022, March 2023, Oct 2023)\n",
"**Fairbanks area / Interior Alaska --> Boreal Forest**\n",
"- FLCF - Farmer’s Loop and Creamer’s Field (001-108)\n",
"- CPCRW - Caribou-Poker Creek Research Watershed (200-283)\n",
"- BCEF - Bonanza Creek Experimental Forest (300-482)\n",
+ "
\n",
"\n",
- "**Vegetation Classes** [National Land Cover Dataset](add link)\n",
- "- D - Deciduous\n",
- "- E - Evergreen\n",
- "- S - Shrub\n",
- "- W - Wetland\n",
- "- C - Crop\n",
+ ">**Vegetation Classes:** [(National Land Cover Dataset)](https://www.mrlc.gov/data/nlcd-2016-land-cover-alaska)\n",
+ " D - Deciduous,\n",
+ " E - Evergreen,\n",
+ " S - Shrub,\n",
+ " W - Wetland,\n",
+ " C - Crop\n",
+ "\n",
+ ">**Snow Depth Classes:**\n",
+ " B - Below Average,\n",
+ " N - Average (neutral),\n",
+ " A - Above Average\n",
"\n",
- "**Snow Depth Classes**\n",
- "- B - Below Average\n",
- "- N - Average (neutral)\n",
- "- A - Above Average\n",
"\n",
"**North Slope Alaska --> Arctic Tundra**\n",
"- UKT - Upper Kuparuk-Toolik (500-566)\n",
"- ACP - Alaska Coastal Plain (600-800)\n",
"\n",
- "**Vegetation Classes**\n",
- "- (Not used for Tundra sites)\n",
+ "\n",
+ ">**Vegetation Classes**\n",
+ " (Not used for Tundra sites)\n",
" \n",
- "**Snow Depth Classes** (Lidar?? and SnowModel results)\n",
- "- N - Neutral (windward)\n",
- "- A - Above Neutral (leeward)\n",
- "- D - Snow Drift\n",
- "- I - Ice Cover (lake/river) - only visited March 2023\n",
+ ">**Snow Depth Classes** (SnowModel terrain, land cover, and snow depth output)
\n",
+ " N - Neutral (windward),\n",
+ " A - Above Neutral (leeward),\n",
+ " D - Snow Drift,\n",
+ " I - Ice Cover (lake/river) - only visited March 2023\n",
"\n",
- "**Flight Lines**\n",
+ "**Flight Lines**
\n",
"- FLCF (2): North, SW\n",
"- BCEF (3): NE, SW, North\n",
"- CPCRW (1): East\n",
@@ -243,25 +242,21 @@
"- CPCRW - Caribou-Poker Creek Research Watershed\n",
"- DEJU - Delta Junction Research Area\n",
"\n",
- "\n",
- "\n",
+ "![](./content/02_FLCF-map.jpg)\n",
+ "**Figure 7.** Farmers Loop Creamers Field (FLCF) field site (one of five SWE/depth focused study sites for the Alaska IOP). Snow pit study plots (colored points) distributed within the SWESARR flight swaths (green rectangle) and lidar flight box (red line). Pit sites are marked with October 2022 (white triangle) and March 2023 (black circle) site visits. \n",
"\n",
"![](./content/02_ak-sites-n-flights.png)\n",
"\n",
- "**Figure X.** SWESARR science lines (yellow boxes) and associated flight lines (red line) over each site. \n",
- "\n",
- "\n",
- "\n",
- "\n",
+ "**Figure 8.** SWESARR science lines (yellow boxes) and associated flight lines (red line) over each site. \n",
"\n",
"\n",
"![](./content/02_ak-boreal-vegclass.png)\n",
"\n",
- "**Figure X.** Represenative land cover classes for the boreal forests taken from the Southeast corner of the 5x5 m study plot. \n",
+ "**Figure 9.** Represenative land cover classes for the boreal forests taken from the Southeast corner of the 5x5 m study plot. \n",
"\n",
"![](./content/02_ak-sampling-design.png)\n",
"\n",
- "**Figure X.** The study plot sampling design for the SWE/snow depth focused campaign. Field crews marked the Southeast corner and measured square-depths around the 5x5 m perimeter on a 1m interval. Snow depths were collected on a north and west transect of 20 m (15 m addition to the study plot perimeter) or a spiral pattern was used depending on depth instrument availability. The snow pit was excavated in the center of the study plot. SSA measurements were collected inside the ~1x1 m snow pit. SMP measurments were taken at the front of the snow pit and up to 50 m from the snow pit. \n",
+ "**Figure 10.** The study plot sampling design for the SWE/snow depth focused campaign. Field crews marked the Southeast corner and measured square-depths around the 5x5 m perimeter on a 1m interval. Snow depths were collected on a north and west transect of 20 m (15 m addition to the study plot perimeter) or a spiral pattern was used depending on depth instrument availability. The snow pit was excavated in the center of the study plot. SSA measurements were collected inside the ~1x1 m snow pit. SMP measurments were taken at the front of the snow pit and up to 50 m from the snow pit. \n",
"\n",
"____"
]
diff --git a/book/tutorials/snowex-core/03_snowex_data_preview.ipynb b/book/tutorials/snowex-core/03_snowex_data_preview.ipynb
index bb6b802..1fb2e86 100644
--- a/book/tutorials/snowex-core/03_snowex_data_preview.ipynb
+++ b/book/tutorials/snowex-core/03_snowex_data_preview.ipynb
@@ -30,8 +30,8 @@
"id": "e7d2ed75-2386-4178-a03d-da4bc2509ec7",
"metadata": {},
"source": [
- "## Spatial Focused Data\n",
- "Let's take a look at data collected during the Intense Observation Periods (IOP) campaigns via EarthAcess data downloads. "
+ "## PART I: Spatial Data\n",
+ "Let's take a look at data collected during the Intense Observation Periods (IOP) campaigns via **EarthAcess** data downloads. "
]
},
{
@@ -65,8 +65,10 @@
"# standard imports\n",
"import pandas as pd\n",
"import pyproj\n",
+ "import datetime\n",
"\n",
"# plotting imports\n",
+ "import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"# from matplotlib import gridspec # do I use?\n",
"import matplotlib.dates as mdates\n",
@@ -89,7 +91,7 @@
"id": "bb8ff033-1080-4798-bc96-de83b60da6bc",
"metadata": {},
"source": [
- "Now we continue by accessing data with our EarthData accounts"
+ "Now we continue by accessing data with our EarthData accounts from NSIDC."
]
},
{
@@ -238,7 +240,7 @@
"id": "43b66540-34cd-4705-9ae1-e3b2a4ba1aad",
"metadata": {},
"source": [
- "Now that we have added Latitude and Longitude columns, let's look at the spatial extent of the data"
+ "Now that we have added Latitude and Longitude columns, let's look at the spatial extent of the data."
]
},
{
@@ -538,8 +540,11 @@
"metadata": {},
"source": [
"### II: 2023 Arctic Tundra and Boreal Forest, Alaska\n",
- "Objective - Compare snow depth, density and SWE data from the Adirondack snow sampler (n=84) and snow pits (n=170)\\\n",
+ "Objectives:\n",
+ "- Compare snow depth, density and SWE data from the Adirondack snow sampler (n=84) and snow pits (n=170)\n",
+ "- Explore data within the `snowexsql` database\n",
"Data description - SnowEx 2023 March 2023 IOP Snow Water Equivalent and Snow Pit Measurements\\\n",
+ "\n",
"Datasets -\n",
"1. [SnowEx23 Snow Water Equivalent, Version 1](https://nsidc.org/data/snex23_swe/versions/1) (2-days of Adirondack snow sampler measurements North Slope (tundra) and Fairbanks (boreal forest))\n",
"2. SnowEx23 Snow Pit Measurements, Version 1 (in prep., available on the `snowexsql` database)"
@@ -573,6 +578,8 @@
"s23 = pd.read_csv('./Downloads/SNEX23_SWE_Mar23IOP_AK_20230313_20230316_v01.0.csv', header=42, na_values=-9999)\n",
"s23 = s23.iloc[1:] # selects the row below the header number cols(1, 2, 3, ... etc.)\n",
"s23 = s23.reset_index(drop=True)\n",
+ "s23['County'] = s23['County'].replace({'Fairbanks': 'FLCF \\n(Boreal Forest)', 'North Slope': 'UKT \\n(Arctic Tundra)'})\n",
+ "\n",
"s23.head()"
]
},
@@ -591,7 +598,7 @@
"id": "e7d6142e-3429-4180-9c2a-61bdf2b98252",
"metadata": {},
"source": [
- "Okay, back to some analysis. We need to get the mean of all three samples (containted in three different columns)"
+ "Okay, back to some data analysis. "
]
},
{
@@ -603,7 +610,7 @@
"source": [
"# CREATE DEPTH, DENSITY, and SWE Boxplots with the SWE Adirondack snow sampler\n",
"\n",
- "# Combine the SWE, Depth, and Density columns for plotting\n",
+ "# Combine the SWE, Depth, and Density columns for plotting (3 samples/location)\n",
"df_melted = pd.melt(s23, id_vars=['State', 'County'], value_vars=['SWE1', 'SWE2', 'SWE3', 'Depth1', 'Depth2', 'Depth3', 'Density1', 'Density2', 'Density3'],\n",
" var_name='Measurement', value_name='Value')\n",
"\n",
@@ -616,7 +623,7 @@
"fig, axs = plt.subplots(1, 3, figsize=(14, 6))\n",
"\n",
"# Define the custom order and labels\n",
- "custom_order = ['Fairbanks', 'North Slope']\n",
+ "custom_order = ['FLCF \\n(Boreal Forest)', 'UKT \\n(Arctic Tundra)']\n",
"\n",
"# Plot the SWE boxplot\n",
"sns.boxplot(data=swe_df, x='County', y='Value', ax=axs[0], color='gray', order=custom_order)\n",
@@ -643,7 +650,7 @@
"id": "97c7d3d2-ed6a-415c-b352-0ab1e7d7d9ba",
"metadata": {},
"source": [
- "We can compare our Adirondack snow sampler results to the snow pit measurement. The boxplots below were generated during the review and data submission preparation work for the March 2023 snow pits. Notice, the snow pit trends match those of the snow sampler tube. The median SWE is higher in the boreal forest (Fairbanks sites) as a result of the deeper snow. Overall, the tundra (North Slope sites) has greater density.\n",
+ "We can compare our Adirondack snow sampler results to the snow pit measurement. The boxplots below were generated during the review and data submission preparation work for the March 2023 snow pits. Notice, the snow pit trends match those of the snow sampler tube. The median SWE is higher in the boreal forest as a result of the deeper snow. Overall, the tundra sites have greater density.\n",
"\n",
"![](./content/03_ak-pits-boxplots.png)\n"
]
@@ -672,9 +679,9 @@
"WRONG. \n",
"\n",
"Here are some challenges we encountered daily:\n",
- "1. Ground vegetation - where is 0?? Often, the bottom of the snowpack varied more than the snow surface! \n",
- "2. Tussocks, what are they and why are there so many? (NOTE - tussocks were better quantified during the October sampling periods when snow was low.\n",
- "3. Snow Voids - snowpack bottoms were not always flush to the ground surface and could be overestimated. Grassy vegetation mats, downed brush and shrubs, or other vegetation creates air pockets or vegetation gaps near the ground surface. Sometimes, the snow was suspended by 10-25 cm depending on the site. "
+ "1. **Ground vegetation** - where is 0? Often, the bottom of the snowpack varied more than the snow surface! \n",
+ "2. [**Tussocks**](https://en.wikipedia.org/wiki/Tussock_grass), what are they and why are there so many? (NOTE - tussocks were better quantified during the October sampling periods when snow was low.\n",
+ "3. **Snow Voids** - snowpack bottoms were not always flush to the ground surface and could be overestimated. Grassy vegetation mats, downed brush and shrubs, or other vegetation creates air pockets or vegetation gaps near the ground surface. Sometimes, the snow was suspended by 10-25 cm depending on the site. "
]
},
{
@@ -682,120 +689,329 @@
"id": "835c7b48-a5d2-469d-bda5-9d94ff5ee128",
"metadata": {},
"source": [
- "These data are really exiting to look at because it's the newest in the SnowEx collection following the Alaska campaign. \n",
+ "These data are really exciting to look at because it's the newest in the SnowEx collection following the Alaska campaign. \n",
"\n",
- "Let's make sure we cover some of the Time Series data as that has matured since the last SnowEx Hackweek event. "
+ "Let me introduce the **`snowexsql`** database by demonstrating how to run an example query. To work from the database, we are going to add some necessary imports. \n",
+ "#### Set Up Computing Environment"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "0982d0cc-1950-44e6-9cb0-b033bc5eb6f4",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#database imports\n",
+ "from snowexsql.db import get_db\n",
+ "from snowexsql.data import PointData, LayerData, ImageData, SiteData\n",
+ "from snowexsql.conversions import query_to_geopandas"
]
},
{
"cell_type": "markdown",
- "id": "32a2a1d5-1b04-40d2-b58a-fa78bc6eca73",
+ "id": "c8347590-f21f-4482-9ad8-746cb8a91496",
"metadata": {},
"source": [
- "_____\n",
+ "### The Basics\n",
+ "#### How are the data contained?\n",
+ "![](./content/03_db-layers.png)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "a3f7e310-368d-499b-bcbb-65d8972da711",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# load the database\n",
+ "db_name = 'snow:hackweek@db.snowexdata.org/snowex'\n",
+ "engine, session = get_db(db_name)\n",
"\n",
- "![](https://ugokawaii.com/wp-content/uploads/2023/02/gears.gif)\n",
- "## Temporal Focused Data\n",
- "Let's take a look at data collected during the weekly Time Series (TS) campaigns using the `snowexsql` database for data access."
+ "print('SnowEx Database successfully loaded!')"
]
},
{
"cell_type": "markdown",
- "id": "fa05e6a4-51b0-4a1a-aed0-02c1fa880b6c",
+ "id": "34cde3d4-146a-4e5c-a547-e9e6ae562cb7",
"metadata": {},
"source": [
- "### III: 2020/2021 Western U.S Time Series \n",
- "Objective - Explore data within the `snowexsql` database\\\n",
- "Data description - [specify here] \\\n",
- "Datasets -\n",
- "1. [SnowEx20 Time Series Snow Pit Measurements, Version 2 ](https://nsidc.org/data/snex20_ts_sp/versions/2)\n",
- "2. [SnowEx21 Time Series Snow Pit Measurements, Version 1](https://nsidc.org/data/snex21_ts_sp/versions/1)"
+ "### What's the first thing you might like to do using the database?\n",
+ "Find overlapping data for data analysis comparison."
]
},
{
"cell_type": "markdown",
- "id": "d539b2c9-454a-48b5-8ac2-cb2d090ec93b",
+ "id": "51f1b818-1b6e-4e64-ab5a-6415734a6a17",
+ "metadata": {},
+ "source": [
+ "### Example 1: Let's find all the pits that overlap with an airborne sensor of interest.\n",
+ "First, it would be helpful to know which of the airborne sensors are part of the database, right?"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "509a213c-6b2a-460d-95cb-697f7fe0e6d3",
"metadata": {},
+ "outputs": [],
"source": [
- "Let me start by sharing a teaser of what's we can do with weekly snow pit observations from multiple sites around the Western U.S. \n",
+ "# Query the session using .observers() to generate a list\n",
+ "qry = session.query(ImageData.observers)\n",
"\n",
- "![](./content/03_pitprogression-BogusBasin.png)\n",
+ "# Locate all that are distinct\n",
+ "airborne_sensors_list = session.query(ImageData.observers).distinct().all()\n",
"\n",
- "**Figure X** (cap here)"
+ "print('list of airborne sensors by \"observer\" name: \\n', airborne_sensors_list)"
]
},
{
"cell_type": "markdown",
- "id": "f1483c77-fc80-4f38-8ad3-d458f85446bc",
+ "id": "3733c241-047a-4f2f-9d8d-ed507ea74941",
"metadata": {},
"source": [
- "To do this, we are going to use the snowexsql database. Here are the imports we need to gain access. \n",
- "#### Set Up Computing Environment"
+ "Note: 'chris larsen' == airborne lidar data from Alaska"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "76f26766-2fa8-4199-a34e-a73ca737a1e7",
+ "metadata": {},
+ "source": [
+ "### 1a). Unsure of the flight date, but know which sensor you'd like to overlap with, here's how: "
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "0982d0cc-1950-44e6-9cb0-b033bc5eb6f4",
+ "id": "7352dd6f-bd61-4f70-97ed-893bc8c35410",
"metadata": {},
"outputs": [],
"source": [
- "#database imports\n",
- "from snowexsql.db import get_db\n",
- "from snowexsql.data import PointData, LayerData, ImageData, SiteData\n",
- "from snowexsql.conversions import query_to_geopandas"
+ "# Airborne sensor from list above\n",
+ "sensor = 'chris larsen' # Name given to Alaska Lidar data, observer Dr. Chris Larsen\n",
+ "\n",
+ "# Form a query on the Images table that returns Raster collection dates\n",
+ "qry = session.query(ImageData.date)\n",
+ "\n",
+ "# Filter for Alaska Lidar data\n",
+ "qry = qry.filter(ImageData.observers == sensor)\n",
+ "\n",
+ "# Grab the unique dates\n",
+ "qry = qry.distinct()\n",
+ "\n",
+ "# Execute the query \n",
+ "dates = qry.all() \n",
+ "\n",
+ "# Clean up the dates \n",
+ "dates = [d[0] for d in dates] \n",
+ "dlist = [str(d) for d in dates]\n",
+ "dlist = \", \".join(dlist)\n",
+ "print('%s flight dates are: %s' %(sensor, dlist))\n",
+ "\n",
+ "# Find all the snow pits done on these days\n",
+ "qry = session.query(SiteData.geom, SiteData.site_id, SiteData.date)\n",
+ "qry = qry.filter(SiteData.date.in_(dates))\n",
+ "\n",
+ "# Return a geopandas df\n",
+ "df = query_to_geopandas(qry, engine)\n",
+ "\n",
+ "# View the returned dataframe!\n",
+ "print(df.head())\n",
+ "print(f'{len(df.index)} records returned')\n",
+ "\n",
+ "# Close your session to avoid hanging transactions\n",
+ "session.close()"
]
},
{
"cell_type": "markdown",
- "id": "c8347590-f21f-4482-9ad8-746cb8a91496",
+ "id": "06e6a1e4-0388-46a8-9f1e-a919f7df4967",
"metadata": {},
"source": [
- "### The Basics\n",
- "#### How are the data contained?\n",
- "![](./content/03_db-layers.png)"
+ "## 1b).Want to select an exact flight date match? Here's how:"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "a3f7e310-368d-499b-bcbb-65d8972da711",
+ "id": "ce2e58fe-7639-41ad-a306-5094c977e104",
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "# Pick a day from the list of dates\n",
+ "dt = dates[1] # selecting the \"2nd\" date in the list, 203-03-11 during the March 2023 field campaign\n",
+ "\n",
+ "# Find all the snow pits done on these days \n",
+ "qry = session.query(SiteData.geom, SiteData.site_id, SiteData.date)\n",
+ "qry = qry.filter(SiteData.date == dt)\n",
+ "\n",
+ "# Return a geopandas df\n",
+ "df_exact = query_to_geopandas(qry, engine)\n",
+ "\n",
+ "print('%s pits overlap with %s on %s' %(len(df_exact), sensor, dt))\n",
+ "\n",
+ "# View snows pits that align with first UAVSAR date\n",
+ "df_exact.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "16a6e762-ca3e-4d73-a3ba-4ec3311d3891",
+ "metadata": {},
+ "source": [
+ "### 1c). Want to further refine your search to select data from a specific Alaska study site? Here's how:"
+ ]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "89d66b97-fff0-4bb9-802d-43777dff7e79",
+ "id": "7b147a11-7957-4bc8-9a1c-1fe356062abe",
"metadata": {},
"outputs": [],
"source": [
- "# decide how much to use from 2022 tutorial\n",
+ "# Refine your search to Farmers Loop and Creamers Field\n",
+ "site = 'FLCF'\n",
+ "qry = qry.filter(SiteData.site_id == site)\n",
+ "\n",
+ "# Return a geopandas df\n",
+ "df_exact = query_to_geopandas(qry, engine)\n",
"\n",
- "# mini leadup examples (1a, 1b, 1c, 1d - mini queries, very helpful to introduce!)\n",
+ "print('%s pits overlap with %s at %s' %(len(df_exact), sensor, site))\n",
"\n",
- "# plot snow temp profiles\n",
- "# find where we have liquid water content (LWC) data "
+ "# View snows pits that align with first UAVSAR date\n",
+ "df_exact.head()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "00a5db8e-a828-41ce-bfc8-335183fd4d00",
+ "metadata": {},
+ "source": [
+ "### 1d). Have a known date that you wish to select data for, here's how:"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "ee8f7b32-5a0f-4c63-b268-534290b2d1bb",
+ "id": "85624b20-38be-4070-aab1-a2e1e830f0f1",
"metadata": {},
"outputs": [],
"source": [
- "# wrap it all up nicely!"
+ "# Find all the data that was collected on 3-11-2023 (i.e. the same day we selected airborne lidar data for)\n",
+ "dt = datetime.date(2023, 3, 11)\n",
+ "\n",
+ "#--------------- Point Data -----------------------------------\n",
+ "# Grab all Point data instruments from our date\n",
+ "point_instruments = session.query(PointData.instrument).filter(PointData.date == dt).distinct().all()\n",
+ "point_type = session.query(PointData.type).filter(PointData.date == dt).distinct().all()\n",
+ "\n",
+ "# Clean up point data (i.e. remove tuple)\n",
+ "point_instruments = [p[0] for p in point_instruments if p[0] is not None]\n",
+ "point_instruments = \", \".join(point_instruments)\n",
+ "point_type = [p[0] for p in point_type]\n",
+ "point_type = \", \".join(point_type)\n",
+ "print('Point data on %s are: %s, with the following list of parameters: %s' %(str(dt), point_instruments, point_type))\n",
+ "\n",
+ "#--------------- Layer Data -----------------------------------\n",
+ "# Grab all Layer data instruments from our date\n",
+ "layer_instruments = session.query(LayerData.instrument).filter(LayerData.date == dt).distinct().all()\n",
+ "layer_type = session.query(LayerData.type).filter(LayerData.date == dt).distinct().all()\n",
+ "\n",
+ "# Clean up layer data \n",
+ "layer_instruments = [l[0] for l in layer_instruments if l[0] is not None]\n",
+ "layer_instruments = \", \".join(layer_instruments)\n",
+ "layer_type = [l[0] for l in layer_type]\n",
+ "layer_type = \", \".join(layer_type)\n",
+ "print('\\nLayer Data on %s are: %s, with the following list of parameters: %s' %(str(dt), layer_instruments, layer_type))\n",
+ "\n",
+ "#--------------- Image Data -----------------------------------\n",
+ "# Grab all Image data instruments from our date\n",
+ "image_instruments = session.query(ImageData.instrument).filter(ImageData.date == dt).distinct().all()\n",
+ "image_type = session.query(ImageData.type).filter(ImageData.date == dt).distinct().all()\n",
+ "\n",
+ "# Clean up image data \n",
+ "image_instruments = [i[0] for i in image_instruments]\n",
+ "image_instruments = \", \".join(image_instruments)\n",
+ "image_type = [i[0] for i in image_type if i[0] is not None]\n",
+ "image_type = \", \".join(image_type)\n",
+ "print('\\nImage Data on %s are: %s, with the following list of parameters: %s' %(str(dt), image_instruments, image_type))"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "46aab5fd-ba59-4cd2-8e5c-e6d6974471a3",
+ "id": "f6d351ed-deaa-4833-b22b-3bcb34e0d300",
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "# fix this\n",
+ "qry = session.query(LayerData.value).filter(LayerData.type=='grain_type')\n",
+ "qry = qry.filter(LayerData.value=='MFcr')\n",
+ "count = qry.count()\n",
+ "\n",
+ "print('The number of Layer Data containing melt-freeze crusts (MFcr) on %s are: %s' %(str(dt), count))\n",
+ "\n",
+ "session.close()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b9c0a2f5-dcfc-46e9-a789-795d73c58a2e",
+ "metadata": {},
+ "source": [
+ "### For more useful examples of querying and plotting please visit previous tutorial materials:\n",
+ "[Hackweek 2022 - 03_snowex_database_preview](https://snowex-2022.hackweek.io/tutorials/core-datasets/03_database_preview.html) (Examples #2 & #3)\n",
+ "- Example #2 - plot snow depth profiles from open Time Series sites.\n",
+ "- Example #3 - search for available liquid water content data through an interactive map. \n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "df31e2e5-8b7e-465d-9168-b110f77d652c",
+ "metadata": {},
+ "source": [
+ "\n",
+ "## PART II: Temporal Data (teaser)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "cffe22c9-8cf4-436f-a63c-c0fd5636f4d7",
+ "metadata": {},
+ "source": [
+ "### III: 2020/2021 Western U.S Time Series \n",
+ "Objective - Explore data within the `snowexsql` database\\\n",
+ "Data description - weekly* snow pit data from multiple western U.S sites (*weekly does not apply perfectly to all sites). \\\n",
+ "Datasets -\n",
+ "1. [SnowEx20 Time Series Snow Pit Measurements, Version 2 ](https://nsidc.org/data/snex20_ts_sp/versions/2)\n",
+ "2. [SnowEx21 Time Series Snow Pit Measurements, Version 1](https://nsidc.org/data/snex21_ts_sp/versions/1)\n",
+ "\n",
+ "Let's conclude by studying this figure that captures weekly measurements from the Time Series (TS) campaigns. The Time Series field camapaign data products have matured since the last SnowEx Hackweek event. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "de046cac-55f9-4025-8796-282027633da6",
+ "metadata": {},
+ "source": [
+ "![](./content/03_pitprogression-BogusBasin.png)\n",
+ "\n",
+ "**Figure.** Snowpack evolution at Bogus Basin (6,850 ft.) near Boise, Idaho. Top row: (left) - Density cutter measurements where the vertical bar shows 10 cm sample extent. (middle) - Snow temperature profile from digital thermometer. (right) - Liquid Water Content (LWC) measurements derived from A2 WISe sensor. Bottom row: Stratigraphy profile of snow according to grain type and layer hardness. Note the change in snow depth over time and the appearance of ice layers (IF) and melt-freeze crusts (MFcr) along with the transition from round grains (RG) to facets (FC). "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bc7d1f98-6bcb-4f30-ad97-4d6faf7c2fe1",
+ "metadata": {},
+ "source": [
+ "## Recap\n",
+ "\n",
+ "* You know how to access NSIDC data and interact with 2017 & 2020 Grand Mesa and Senator Beck, Colorado SWE data.\n",
+ "* You are aware of some general trends in tundra vs. boreal forest data and can form queries using the `snowexsql` database.\n",
+ "* You have knowledge of what can be harnessed from the 2020 & 2021 Western U.S Time Series campaigns. "
+ ]
}
],
"metadata": {
diff --git a/book/tutorials/snowex-core/content/02_FLCF-map.jpg b/book/tutorials/snowex-core/content/02_FLCF-map.jpg
new file mode 100644
index 0000000..5480cbd
Binary files /dev/null and b/book/tutorials/snowex-core/content/02_FLCF-map.jpg differ
diff --git a/book/tutorials/snowex-core/content/02_depth_spirals.png b/book/tutorials/snowex-core/content/02_depth_spirals.png
index e685663..6f296e4 100644
Binary files a/book/tutorials/snowex-core/content/02_depth_spirals.png and b/book/tutorials/snowex-core/content/02_depth_spirals.png differ
diff --git a/book/tutorials/snowex-core/content/02_pit-parameters.png b/book/tutorials/snowex-core/content/02_pit-parameters.png
index 42ce140..db6829c 100644
Binary files a/book/tutorials/snowex-core/content/02_pit-parameters.png and b/book/tutorials/snowex-core/content/02_pit-parameters.png differ