You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"This tutorial focuses on calibrating SWIM-RS for a single unirrigated plot: a 3-pixel buffer around FluxNet's US-FPe eddy covariance station from John Volk's Flux ET benchmark dataset. The flux station provides independent observations of both meteorology and ET flux, allowing us to validate our model.\n",
13
-
"\n",
14
-
"This notebook demonstrates:\n",
15
-
"1. Loading pre-built model input data from a SwimContainer\n",
16
-
"2. Running the uncalibrated SWIM model\n",
17
-
"3. Comparing model output with flux tower observations\n",
18
-
"\n",
19
-
"**Reference:** This example is based on John Volk's flux footprint study:\n",
"**Input Data:** The `data/2_Fort_Peck.swim/` container stores pre-computed input data, so you can get started right away. If you want to build or rebuild the data for this example, we have provided scripts for reproduction:\n",
28
-
"\n",
29
-
"1. **Extract data** from Earth Engine and GridMET:\n",
30
-
" ```bash\n",
31
-
" cd data/\n",
32
-
" python extract_data.py # Extract US-FPe only (default)\n",
33
-
" python extract_data.py --help # See all options\n",
34
-
" ```\n",
35
-
"\n",
36
-
"2. **Sync from bucket** after EE tasks complete:\n",
"3. **Build model inputs** using the container:\n",
42
-
" ```bash\n",
43
-
" cd data/\n",
44
-
" python build_inputs.py # Build container\n",
45
-
" python build_inputs.py --rebuild # Force rebuild from scratch\n",
46
-
" ```\n",
47
-
"\n",
48
-
"The container (`data/2_Fort_Peck.swim/`) stores all ingested data with provenance tracking.\n",
49
-
"\n",
50
-
"---"
51
-
]
7
+
"source": "# Calibration Tutorial - Fort Peck, MT - Unirrigated Flux Plot\n\n## Step 1: Uncalibrated Model Run\n\nThis tutorial focuses on calibrating SWIM-RS for a single unirrigated plot: a 3-pixel buffer around FluxNet's US-FPe eddy covariance station from John Volk's Flux ET benchmark dataset. The flux station provides independent observations of both meteorology and ET flux, allowing us to validate our model.\n\nThis notebook demonstrates:\n1. Loading pre-built model input data from a SwimContainer\n2. Running the uncalibrated SWIM model\n3. Comparing model output with flux tower observations\n\n**Reference:** This example is based on John Volk's flux footprint study:\n- Paper: https://www.sciencedirect.com/science/article/pii/S0168192323000011\n- Data: https://www.sciencedirect.com/science/article/pii/S2352340923003931\n\n---\n\n### Data Pipeline\n\n**Input Data:** The `data/2_Fort_Peck.swim/` container stores pre-computed input data, so you can get started right away. If you want to build or rebuild the data for this example, we have provided scripts for reproduction:\n\n1. **Extract data** from Earth Engine and GridMET:\n ```bash\n python extract_data.py # Extract US-FPe only (default)\n python extract_data.py --help # See all options\n ```\n\n2. **Sync from bucket** after EE tasks complete:\n ```bash\n gsutil -m rsync -r gs://wudr/2_Fort_Peck/ ./data/\n ```\n\n3. **Build model inputs** using the container:\n ```bash\n python build_inputs.py # Build container\n python build_inputs.py --rebuild # Force rebuild from scratch\n ```\n\nThe container (`data/2_Fort_Peck.swim/`) stores all ingested data with provenance tracking.\n\n---"
52
8
},
53
9
{
54
10
"cell_type": "code",
@@ -166,40 +122,7 @@
166
122
}
167
123
},
168
124
"outputs": [],
169
-
"source": [
170
-
"# Example: Query data directly from the SwimContainer\n",
" print(f\"Container not found at {container_path}\")\n",
201
-
" print(\"Run: cd data && python build_inputs.py --rebuild\")"
202
-
]
125
+
"source": "# Example: Query data directly from the SwimContainer\n\ncontainer_path = os.path.join(data, \"2_Fort_Peck.swim\")\n\nif os.path.exists(container_path):\n container = SwimContainer.open(container_path, mode=\"r\")\n\n # List available fields\n print(f\"Fields in container: {container.field_uids}\")\n\n # Get all time series for a single field using field_timeseries\n ts_df = container.query.field_timeseries(\"US-FPe\")\n print(f\"\\nTime series shape: {ts_df.shape}\")\n print(f\"Variables: {list(ts_df.columns)[:10]}...\")\n\n # Query specific data using dataframe with zarr paths\n # Path structure: remote_sensing/{type}/{instrument}/{model}/{mask}\n ndvi_df = container.query.dataframe(\"remote_sensing/ndvi/landsat/inv_irr\", fields=[\"US-FPe\"])\n print(f\"\\nNDVI observations: {ndvi_df.notna().sum().values[0]}\")\n\n etf_df = container.query.dataframe(\n \"remote_sensing/etf/landsat/ssebop/inv_irr\", fields=[\"US-FPe\"]\n )\n print(f\"ETf observations: {etf_df.notna().sum().values[0]}\")\n\n # Show container status\n print(\"\\n\" + container.query.status())\n\n container.close()\nelse:\n print(f\"Container not found at {container_path}\")\n print(\"Run: python build_inputs.py --rebuild\")"
Copy file name to clipboardExpand all lines: examples/3_Crane/01_uncalibrated_model.ipynb
+3-65Lines changed: 3 additions & 65 deletions
Original file line number
Diff line number
Diff line change
@@ -4,38 +4,7 @@
4
4
"cell_type": "markdown",
5
5
"id": "cell-intro",
6
6
"metadata": {},
7
-
"source": [
8
-
"# Calibration Tutorial - Crane, OR - Irrigated Flux Plot\n",
9
-
"\n",
10
-
"## Step 1: Uncalibrated Model Run\n",
11
-
"\n",
12
-
"This tutorial focuses on calibrating SWIM-RS for a single irrigated alfalfa plot at the S2 flux station in Crane, Oregon. Unlike the unirrigated Fort Peck example, this site is actively irrigated.\n",
13
-
"\n",
14
-
"This notebook demonstrates:\n",
15
-
"1. Loading pre-built model input data from a SwimContainer\n",
16
-
"2. Running the uncalibrated SWIM model\n",
17
-
"3. Comparing model output with the open source members of the OpenET ensemble (PT-JPL, SIMS, SSEBop, geeSEBAL)\n",
18
-
"4. Validation against flux tower observations using multiple metrics (R², r, RMSE, bias)\n",
19
-
"\n",
20
-
"### Data Pipeline\n",
21
-
"\n",
22
-
"**Input Data:** The `data/3_Crane.swim/` container stores pre-computed input data.\n",
23
-
"\n",
24
-
"The full data workflow uses two scripts and can be re-run if needed:\n",
25
-
"\n",
26
-
"1. **`extract_data.py`** - Extracts raw data from Earth Engine and GridMET to CSV/parquet files\n",
27
-
"2. **`build_inputs.py`** - Processes extracted data through SwimContainer\n",
28
-
"\n",
29
-
"To reproduce the input data from scratch:\n",
30
-
"\n",
31
-
"```bash\n",
32
-
"cd data\n",
33
-
"python extract_data.py # Extract from EE/GridMET (requires authentication)\n",
34
-
"python build_inputs.py # Build container\n",
35
-
"```\n",
36
-
"\n",
37
-
"See `data/extract_data.py` for extraction options and `data/build_inputs.py` for container workflow details."
38
-
]
7
+
"source": "# Calibration Tutorial - Crane, OR - Irrigated Flux Plot\n\n## Step 1: Uncalibrated Model Run\n\nThis tutorial focuses on calibrating SWIM-RS for a single irrigated alfalfa plot at the S2 flux station in Crane, Oregon. Unlike the unirrigated Fort Peck example, this site is actively irrigated.\n\nThis notebook demonstrates:\n1. Loading pre-built model input data from a SwimContainer\n2. Running the uncalibrated SWIM model\n3. Comparing model output with the open source members of the OpenET ensemble (PT-JPL, SIMS, SSEBop, geeSEBAL)\n4. Validation against flux tower observations using multiple metrics (R², r, RMSE, bias)\n\n### Data Pipeline\n\n**Input Data:** The `data/3_Crane.swim/` container stores pre-computed input data.\n\nThe full data workflow uses two scripts and can be re-run if needed:\n\n1. **`extract_data.py`** - Extracts raw data from Earth Engine and GridMET to CSV/parquet files\n2. **`build_inputs.py`** - Processes extracted data through SwimContainer\n\nTo reproduce the input data from scratch:\n\n```bash\npython extract_data.py # Extract from EE/GridMET (requires authentication)\npython build_inputs.py # Build container\n```\n\nSee `extract_data.py` for extraction options and `build_inputs.py` for container workflow details."
39
8
},
40
9
{
41
10
"cell_type": "code",
@@ -255,38 +224,7 @@
255
224
}
256
225
},
257
226
"outputs": [],
258
-
"source": [
259
-
"# Query container data (optional - requires build_inputs.py to have been run)\n",
" print(f\"Container not found at {container_path}\")\n",
288
-
" print(\"Run: cd data && python build_inputs.py\")"
289
-
]
227
+
"source": "# Query container data (optional - requires build_inputs.py to have been run)\n\ncontainer_path = os.path.join(data, \"3_Crane.swim\")\n\nif os.path.exists(container_path):\n container = SwimContainer.open(container_path, mode=\"r\")\n\n # List available fields\n print(f\"Fields in container: {container.field_uids}\")\n\n # Get all time series for a single field using field_timeseries\n ts_df = container.query.field_timeseries(\"S2\")\n print(f\"\\nTime series shape: {ts_df.shape}\")\n print(f\"Variables: {list(ts_df.columns)[:10]}...\")\n\n # Query specific data using dataframe with zarr paths\n # Path structure: remote_sensing/{type}/{instrument}/{model}/{mask}\n ndvi_df = container.query.dataframe(\"remote_sensing/ndvi/landsat/irr\", fields=[\"S2\"])\n print(f\"\\nNDVI observations: {ndvi_df.notna().sum().values[0]}\")\n\n etf_df = container.query.dataframe(\"remote_sensing/etf/landsat/ssebop/irr\", fields=[\"S2\"])\n print(f\"ETf observations: {etf_df.notna().sum().values[0]}\")\n\n # Show container status\n print(\"\\n\" + container.query.status())\n\n container.close()\nelse:\n print(f\"Container not found at {container_path}\")\n print(\"Run: python build_inputs.py\")"
0 commit comments