pointsnobal
Description
Python wrapped implementation of the Snobal model applied at a point, provided by M3 Works.
The code in pointsnobal/c_snobal
is the same underlying algorithms described in A spatially distributed energy balance snowmelt model for application in mountain basins (Marks 1999), which details iSnobal. This code was originally available in IPW.
This software takes in a csv of HOURLY input data and writes a csv of daily snowpack data.
🚀 Calling Snow Researchers & Students! 🚀
At M3 Works, we’re passionate about advancing scientific research and education! 🌍📊
That’s why we offer free access to our PointSnobal API for qualifying research and educational projects. Whether you’re modeling snow processes or exploring hydrology, we’re here to support your work!
🔑 Request an API key on our website -> https://m3works.io/contact
Let’s collaborate and push the boundaries of environmental modeling together! ❄️📡
This API is provided under the same license listed in this directory. The API and code are provided “as is”, and M3 Works LLC makes no guarantees of functionality, performance, or fitness for any particular purpose.
M3 Works LLC shall not be held liable for any direct, indirect, incidental, or consequential damages arising from the use or inability to use this API or its associated code.
Use of this API constitutes acceptance of the terms and conditions outlined in the accompanying license.
Example of api usage in python
from pathlib import Path
import requests
import pandas as pd
api_key = "<your key>"
api_id = "bktiz24e19"
file_path = Path("<path to your input csv file>")
elevation = 1000 # your point elevation in meters
url = f"https://{api_id}.execute-api.us-west-2.amazonaws.com/m3works/snobal"
params = {"elevation": elevation}
output_file_name = file_path.name.replace('inputs', 'snobal')
output_file = file_path.parent.joinpath(output_file_name)
# Headers
headers = {
"x-api-key": api_key,
"Content-Type": "text/csv"
}
print("Reading file and calling API")
# Load the CSV file as binary data
with open(str(file_path), "rb") as file:
response = requests.post(
url, headers=headers, params=params, data=file)
print("API request finished")
# error if we failed
response.raise_for_status()
result = response.json()
print("Parsing results")
# Get result into pandas
df = pd.DataFrame.from_dict(result['results']["data"])
Use scripts/use_api.py
to call the api from the command line
python3 scripts/use_api.py <path to your file> \ <your point elevation> --api_key <your api key>
This will output a csv file of the results. Run python3 scripts/use_api.py --help
for a full list of options.
These variables are directly used within snobal
air_temp
- modeled air temp at 2m above groundpercent_snow
- % mix of snow vs rain (1 == all snow) [decimal percent]precip
- precipitation mass [mm]precip_temp
- wet bulb temperaturesnow_density
- density of the NEW snow that hour [kg/m^3]vapor_pressure
- modeled vapor pressurewind_speed
- Wind speed at 5m above ground [m/s]soil_temp
- Average temperature of the soil column down to 30cmnet_solar
- net solar into the snowpack [w/m^2]thermal
- net longwave radiation into the snowpack [w/m^2]
See ./tests/data/inputs_csl_2023.csv
for an example of data format
- wind height: 5m
- air temp height: 2m
- soil temp depth: 0.3m
- Snobal expects temperatures to be in Kelvin. This code expects Celcius. We do the conversion in
get_timestep_force
- Precip mass (
precip
) is a big driver here. Without accurate conditions, model results will be poor
Files
inputs_csl_2023.csv
Files
(415.9 kB)
Name | Size | Download all |
---|---|---|
md5:bc986773e039488cd462f73ec64d5955
|
21 Bytes | Download |
md5:a7ad97c02fde686877d4312f6b737433
|
2.6 kB | Download |
md5:023bd6a7062c6da716be0c917898ba69
|
2.0 kB | Download |
md5:b7050044a14f3c716687ba577edf82f1
|
722 Bytes | Download |
md5:0b42d2cc7c76abab8391556d5c630a97
|
970 Bytes | Download |
md5:a15a103ef6bbf30ff70f1c9c0014119b
|
1.7 kB | Download |
md5:e53e60110e7e36077e97fdfc1d9f7901
|
796 Bytes | Download |
md5:f78499c011d4eb94f9cd30ae60983ed9
|
2.5 kB | Download |
md5:4240aa58f268417e858468faa1ae35fb
|
3.9 kB | Download |
md5:17040c663d70b96569c8d18636db283d
|
4.4 kB | Download |
md5:122fc2406581d793928e3a24377da48b
|
1.6 kB | Download |
md5:7f1f4367220ac1a524b1d4647297a9f1
|
221 Bytes | Download |
md5:482f6e21409081b4b813d031615b2a58
|
657 Bytes | Download |
md5:714aba4862c6f2fd54f18940a6f499a3
|
3.2 kB | Download |
md5:f22a23a27e2b3463e5b0c1c68fd44f9d
|
10.1 kB | Download |
md5:d730bc5f74daf743a17d2653b616800a
|
2.5 kB | Download |
md5:ebf4fa6bedfebd3e3020ad2431f9f932
|
1.6 kB | Download |
md5:72ba94e8c8a8d67e919c5c3a722e02ad
|
725 Bytes | Download |
md5:a247b1e25d786fae217b53393346a2cc
|
2.5 kB | Download |
md5:39ff98757491cb1bdb48f43d7d4874df
|
1.4 kB | Download |
md5:d1a565565c61da274917930e7bbf69b2
|
1.9 kB | Download |
md5:1043c656b8044e99b1a932e37d7d2756
|
595 Bytes | Download |
md5:2d745e1f52a435305e606672ea1d7887
|
551 Bytes | Download |
md5:d4b18fed734fb316f56a73304db22840
|
969 Bytes | Download |
md5:25d4f5745c352f1949a9ed85ae241060
|
1.7 kB | Download |
md5:f7fd33b19e3600566aa8034742eae267
|
1.5 kB | Download |
md5:575d9b8845bb7383850824b9e61560a3
|
2.3 kB | Download |
md5:d388ada7564166114df5e3d5c89beba5
|
3.3 kB | Download |
md5:527757723258a5b5e25dfc3a06610ad3
|
1.0 kB | Download |
md5:09333e76fd09148e2b3e21d93fb6f13a
|
1.0 kB | Download |
md5:14c7a6813d6c327f1e1fecf5ce15b39b
|
5.8 kB | Download |
md5:4895694721e155a563ceac841e69f43d
|
1.2 kB | Download |
md5:9560d105a57adaf33f68e2cecb004f8b
|
388 Bytes | Download |
md5:6e0cac4f80859769ccdb07b6b86d2f60
|
2.8 kB | Download |
md5:ea4e44db4ed60dd6f5991066cc62669f
|
298 Bytes | Download |
md5:2352f3e7ac9f32ec5c7c6240734220b9
|
2.3 kB | Download |
md5:4a9328a778102370cc59135523f741cc
|
9.1 kB | Download |
md5:f1db05c253f68aec08eb44996de2f3ab
|
1.4 kB | Download |
md5:ab73ae74d9e53a7f56e169ca0f18acde
|
631 Bytes | Download |
md5:a99a181ea36a701e803f32e240d8fcf4
|
3.2 kB | Download |
md5:bce5ba26bc718e7ee95fed1e9d066a23
|
2.0 kB | Download |
md5:de7fa09d6670daa7ccacf2b944f153d4
|
5.8 kB | Download |
md5:c6ed100f35d61220f7df8acd65b82e5d
|
685 Bytes | Download |
md5:966c7a5309b9e26b5052672790b911cc
|
9.8 kB | Download |
md5:72c12f9ad5fc423a50fa93451d488f06
|
339 Bytes | Download |
md5:5390c93fe8d8f4969d9bb7b8d62e5ab6
|
477 Bytes | Download |
md5:1429146c769d92c1f5ad48c2db2294b3
|
755 Bytes | Download |
md5:64d5111c760fa156051d4a705771ae73
|
1.1 kB | Download |
md5:316af8a7a7a93949106ba71dd2ed9961
|
304 Bytes | Download |
md5:182b68b48572ada63eca1a7f4b815c8e
|
1.6 kB | Download |
md5:72c89e2e86b0d90c631b2832ca2fd32d
|
777 Bytes | Download |
md5:4b4b22c460b6352917278d8f9270be92
|
1.3 kB | Download |
md5:e3c3643a588d1c1e0005741ef9c3b09b
|
273 Bytes | Download |
md5:3bcbb0ee2f943309cecb88fd693fdb61
|
143 Bytes | Download |
md5:79944ff8f2ca4ffeb0bd822f4fcf884f
|
6.2 kB | Download |
md5:c159b66d906a6dd7dc237ff26d5f5f4b
|
617 Bytes | Download |
md5:383b3e49ffa6b30cf079bdce4b7f9cbf
|
285 Bytes | Download |
md5:1ce9756818cf40476b2110b0336c549e
|
3.1 kB | Download |
md5:e2d9558c02c56432ca5fc03bfc3ff974
|
2.5 kB | Download |
md5:59eaeabe54f358a7ffca0b46e4c4f225
|
179.6 kB | Preview Download |
md5:e8b661af3bc6e81e16cd2bd7f81aa5a3
|
653 Bytes | Download |
md5:8cfd7df16f40a4bd981f8500a17938c4
|
906 Bytes | Download |
md5:af348e53085c41e7dd0bcc0721f058c0
|
1.5 kB | Download |
md5:e4bda098c631132097ca9534d44d5a65
|
1.7 kB | Download |
md5:3ecd8f202a2ee5344f676dd0e9fbc1de
|
2.4 kB | Download |
md5:ec9ed19d71f992e4d0b20edc57b72e6e
|
4.0 kB | Download |
md5:faaf524ade22349c9351a894bce311b5
|
345 Bytes | Download |
md5:f0125f6ead312986d74c3129dfffeca4
|
1.1 kB | Download |
md5:24d71d80c4e184e9e81c1dbb732f7aeb
|
189 Bytes | Download |
md5:5c4a98608a1aa2981f197944dd08f9de
|
8.1 kB | Download |
md5:7c2fd3b47a842ad3ff3f6ac264cbd623
|
5.2 kB | Download |
md5:4de7315b0a58f5a61d21f7af6993cce1
|
135 Bytes | Download |
md5:f3c29d1b9bc0920e65879947e4e6fe51
|
1.4 kB | Download |
md5:0ffbd0ead65d4186572e2669f6cfedce
|
6.2 kB | Preview Download |
md5:10e92d76845838a38e9f059f7871550f
|
56 Bytes | Preview Download |
md5:eee2934ea21c7444f302f038466e25a8
|
110 Bytes | Preview Download |
md5:178076a24919966bb4b6152b5003e487
|
1.3 kB | Download |
md5:d069db1b27fed10b6a280afe2f9c31ff
|
649 Bytes | Download |
md5:a0b175716e01f9347b17ed100d40c6de
|
672 Bytes | Download |
md5:546eef48862fb07d1a1c66d4e2e484e0
|
198 Bytes | Download |
md5:086a19dbe3be5ef200482c5f41b61e8a
|
2.8 kB | Download |
md5:cbfa85f12f43b10b1f923861c264af8e
|
276 Bytes | Download |
md5:187c5b6e38c88db8dc729ff3071f0afe
|
993 Bytes | Download |
md5:800a515859e25417c929d800bd785e93
|
10.1 kB | Download |
md5:3ea4fc3954ee516aae5a7735c120dec1
|
32.0 kB | Download |
md5:1927268fff97a829799ae7cbe250719a
|
9.9 kB | Download |
md5:88f53c4cdcfe99b43ce8a17424297ae5
|
2.7 kB | Download |
md5:b660652c8086f5c2609c09c856cd0b27
|
920 Bytes | Download |
md5:6c46beb995683c6906644f508518a803
|
506 Bytes | Download |
md5:28d5a015545f1b9b8c4b72b22d268c3b
|
985 Bytes | Download |
md5:754cfbed8480dee1b7c2b20f4cd55fea
|
804 Bytes | Download |
md5:0250361ebfbb0f6eef4434753a93347b
|
292 Bytes | Download |
md5:4b91c9bbc472a2780b9d7048308ec750
|
1.5 kB | Download |
md5:1514a0b016f2d67a2e4af08b200196be
|
960 Bytes | Download |
md5:9983e2fc35f0d72c542112e4bdd8c1c8
|
1.9 kB | Download |
md5:7b56b1e3e6c7ee32d62d3094ec9b709f
|
6.9 kB | Download |
md5:ca5544a78ddc0db53036e5094040ff6a
|
1.4 kB | Download |
Additional details
Related works
- Is supplement to
- Software: https://github.com/M3Works/pointsnobal (URL)
- References
- Software: 10.5281/zenodo.1309970 (DOI)
- Publication: 10.1002/(SICI)1099-1085(199909)13:12/13<1935::AID-HYP868>3.0.CO;2-C (DOI)
- Publication: 10.1016/j.cageo.2020.104571 (DOI)
Software
- Repository URL
- https://github.com/M3Works/pointsnobal
- Programming language
- Python
- Development Status
- Active