Examples¶
This section demonstrates how to run the provided pySnowClim example and what results to expect.
Running the Example Script¶
Overview¶
The examples/run_snowclim_example.py script (also the examples/example.ipynb notebook) provides a complete workflow that:
Loads meteorological forcing data and observations
Runs the pySnowClim model with default parameters
Compares model output with observed snow water equivalent
Generates validation plots and performance statistics
Required Data Files¶
Before running the example, ensure these files are in the examples/ directory:
forcings_example.nc- Meteorological forcing datatarget_example.nc- Observed snow water equivalent for validation
The forcing file contains the following variables:
Variable |
Units |
Description |
|---|---|---|
|
kJ/m²/timestep |
Incoming longwave radiation |
|
kJ/m²/timestep |
Incoming solar radiation |
|
°C |
Mean air temperature |
|
m/timestep |
Total precipitation |
|
m/s |
Wind speed |
|
hPa |
Surface atmospheric pressure |
|
kg/kg |
Specific humidity |
|
% |
Relative humidity |
|
°C |
Dewpoint temperature |
The observation file contains:
swe- Observed snow water equivalent (mm)time- Time coordinate matching the forcing data periodOptional metadata: station name, elevation, latitude, longitude
Running the Example¶
Command Line Execution:
cd examples
python run_snowclim_example.py
Expected Console Output:
============================================================
pySnowClim Example Run
============================================================
Loading forcing data...
Loading observation data...
Forcing data time range: 2001-10-01T00:00:00 to 2002-09-30T00:00:00
Observation data time range: 2001-10-01T00:00:00 to 2002-09-30T00:00:00
Number of forcing time steps: 365
Number of observation time steps: 365
Running pySnowClim model...
Loading necessary files...
Parameter file undefined, using default parameters
Files loaded, running the model...
Model run completed!
Comparing model results with observations...
Comparison Statistics:
Correlation: 0.876
RMSE: 89.3 mm
MAE: 67.2 mm
Bias: -12.4 mm
Validation plot saved to: examples/output/model_validation.png
Validation statistics saved to: examples/output/validation_stats.txt
Example run completed successfully!
Results saved in: examples/output
Expected Results¶
Output Files¶
The example generates the following files in examples/output/:
Model Output Files (NetCDF format):
SnowWaterEq.nc- Snow water equivalent time seriesSnowDepth.nc- Snow depth time seriesSnowMelt.nc- Daily snowmelt amountsAdditional variables (sublimation, condensation, runoff, etc.)
Validation Products:
model_validation.png- Four-panel validation plotvalidation_stats.txt- Performance statistics summary
The example serves as both a validation tool and a template for setting up your own pySnowClim applications.