This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime as dt | |
from regobslib import Connection, SnowRegion, AvalancheObs, AvalancheActivity, SnowRegistration, Incident | |
import json | |
from pathlib import Path | |
from dataclasses import is_dataclass, asdict | |
def _to_serializable(obj): | |
"""Best-effort conversion of regobslib objects to JSON-serializable types.""" | |
# Primitives pass through |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imageio | |
from pathlib import Path | |
# Define the directory containing the PNG files | |
# Adjust this path as necessary. Here, it's set to the current directory. | |
directory_path = Path(r'.') | |
# Step 1: Collect all PNG filenames using pathlib | |
filenames = list(directory_path.glob('*_event.png')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check regobslib for more information: https://github.com/NVE/regobslib | |
from regobslib import * | |
import datetime as dt | |
import pandas as pd | |
import matplotlib.pylab as plt | |
def get_data(): | |
regions = [ | |
SnowRegion.HELGELAND, |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X;Y;Z;M | |
44797.83400349226;6818912.225566525;951.3221999999951;0 | |
44796.98600351438;6818911.695566539;950.6389999999956;0.9980999999970663 | |
44796.13800353557;6818911.165566552;949.9324000000051;1.9962999999988824 | |
44795.29000355676;6818910.635566566;949.1913999999961;2.9943999999959487 | |
44794.44200357795;6818910.10556658;948.5329999999958;3.992599999997765 | |
44793.59400360007;6818909.575566594;947.899900000004;4.990699999994831 | |
44792.74600362126;6818909.045566607;947.2617000000027;5.988899999996647 | |
44791.89800364245;6818908.515566621;946.6616000000067;6.986999999993714 | |
44791.05000366364;6818907.985566631;946.0629999999946;7.98519999999553 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
app = Flask(__name__) | |
@app.route('/') | |
@app.route('/index') | |
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350): | |
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,} | |
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}] | |
title = {"text": 'My Title'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you also need to download this file: https://github.com/luis-almeida/unveil/blob/master/jquery.unveil.js | |
# and place it in the same directory as this python file with the name "jquery.unveil.js" | |
import os | |
from io import BytesIO | |
from flask import Flask, Response, request, abort, render_template_string, send_from_directory | |
from PIL import Image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_df = pd.DataFrame( | |
columns=['aval_type', 'trigger', 'DestructiveSizeName', 'date', 'elevation', 'TerrainStartZoneName', 'Latitude', 'Longitude', 'ForecastRegionName', | |
'ForecastRegionTID', 'nick', 'RegID']) | |
for av in avals: | |
_df = _df.append({'aval_type': av.AvalancheName, | |
'trigger': av.AvalancheTriggerName, | |
'DestructiveSizeName': av.DestructiveSizeName, | |
'date': av.DtObsTime.strftime('%Y-%m-%d'), | |
'elevation': av.Height, | |
'TerrainStartZoneName': av.TerrainStartZoneName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
events: [ | |
{ | |
title: "MKH", | |
start: "2019-06-19" | |
}, | |
{ | |
title: "SBH", | |
start: "2019-06-19" | |
}, |
NewerOlder