Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
visualizer-echarts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Owen Graham
visualizer-echarts
Commits
0d22d0e1
Verified
Commit
0d22d0e1
authored
1 year ago
by
Owen Graham
Browse files
Options
Downloads
Patches
Plain Diff
Leave all years-by-station listing to the API
parent
b4006a39
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
make_station_years_json.py
+0
-51
0 additions, 51 deletions
make_station_years_json.py
station-years.json
+0
-1097
0 additions, 1097 deletions
station-years.json
visualizer/__init__.py
+2
-8
2 additions, 8 deletions
visualizer/__init__.py
visualizer/data.py
+5
-0
5 additions, 0 deletions
visualizer/data.py
with
7 additions
and
1156 deletions
make_station_years_json.py
deleted
100644 → 0
+
0
−
51
View file @
b4006a39
"""
Fetch the stations/years with AWS data and write them to a file.
"""
import
json
import
sys
from
urllib.parse
import
quote
from
urllib.request
import
urlopen
API_ROOT
=
'
https://amrdcdata.ssec.wisc.edu/data-api
'
OUTFILE
=
'
station-years.json
'
def
main
():
print
(
'
Fetching station list
'
,
file
=
sys
.
stderr
)
with
urlopen
(
f
'
{
API_ROOT
}
/aws/list
'
)
as
f
:
aws_list
=
json
.
load
(
f
)
stations
=
[
x
[
0
]
for
x
in
aws_list
[
'
stations
'
]]
def
records_items
():
total
=
len
(
stations
)
s_width
=
max
(
len
(
repr
(
s
))
for
s
in
stations
)
n_width
=
len
(
str
(
total
))
for
n
,
station
in
enumerate
(
stations
,
start
=
1
):
print
((
f
'
Fetching years for
{
station
!r:{
s_width
}}
'
f
'
(
{
n
:{
n_width
}}
/
{
total
}
)
'
),
file
=
sys
.
stderr
)
yield
station
,
years_for_station
(
station
)
records
=
dict
(
records_items
())
print
(
f
'
Writing to
{
OUTFILE
}
'
,
file
=
sys
.
stderr
)
with
open
(
OUTFILE
,
'
w
'
)
as
f
:
json
.
dump
(
records
,
f
,
indent
=
2
)
print
(
'
Done
'
,
file
=
sys
.
stderr
)
def
years_for_station
(
station
):
"""
Fetch the years with AWS data for the given station.
"""
with
urlopen
(
f
'
{
API_ROOT
}
/aws/list/stations=
{
urlesc
(
station
)
}
'
)
as
f
:
years_list
=
json
.
load
(
f
)
return
[
year
for
x
in
years_list
for
year
in
x
]
def
urlesc
(
s
):
"""
Quote a string as a URL path component.
Spaces are encoded as
'
%20
'
.
"""
return
quote
(
s
,
safe
=
''
)
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
station-years.json
deleted
100644 → 0
+
0
−
1097
View file @
b4006a39
{
"AGO-4"
:
[
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"AGO-5"
:
[
2020
],
"Austin"
:
[
2015
,
2016
,
2017
,
2019
,
2020
,
2021
],
"Baldrick"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Bear Peninsula"
:
[
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Bonaparte Point"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
],
"Brianna"
:
[
2003
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
],
"Butler Island"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
],
"Byrd"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Cape Bird"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Cape Denison"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2021
,
2022
,
2023
],
"Cape Hallett"
:
[
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
],
"Cape Spencer"
:
[
2003
,
2004
],
"Carolyn"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
],
"Clean Air"
:
[
2003
,
2004
],
"D-10"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"D-47"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"D-85"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Dismal Island"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
],
"Dome C II"
:
[
1996
,
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Dome Fuji"
:
[
2003
,
2004
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"E-66"
:
[
2009
,
2010
,
2011
],
"Elaine"
:
[
2003
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2022
,
2023
],
"Elizabeth"
:
[
2003
,
2009
,
2010
,
2011
,
2012
,
2013
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Emilia"
:
[
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Emma"
:
[
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Eric"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
],
"Erin"
:
[
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Evans Knoll"
:
[
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
],
"Ferrell"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Ferrell II"
:
[
2011
,
2012
,
2014
],
"Fossil Bluff"
:
[
2009
,
2010
,
2011
,
2012
],
"Gill"
:
[
2001
,
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Harry"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Henry"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Herbie Alley"
:
[
2003
,
2004
],
"Hugo Island"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
],
"Janet"
:
[
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"JASE2007"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Kathie"
:
[
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
],
"Kirkwood Island"
:
[
2003
,
2004
],
"Kominko-Slade"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
],
"Larsen Ice Shelf"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
],
"Laurie II"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Lettau"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Limbert"
:
[
2004
,
2009
,
2010
,
2011
,
2012
],
"Linda"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Lorne"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Manuela"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Marble Point"
:
[
1991
,
1992
,
1993
,
1994
,
1995
,
1996
,
1997
,
1998
,
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Marble Point II"
:
[
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Margaret"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Marilyn"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Marlene"
:
[
2011
,
2012
,
2013
,
2014
],
"Mary"
:
[
2009
,
2010
,
2011
,
2012
],
"Minna Bluff"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2022
,
2023
],
"Mizuho"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Mount Fleming"
:
[
2009
,
2010
,
2011
],
"Mount Siple"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2015
,
2016
,
2017
,
2018
,
2019
],
"Mulock"
:
[
2009
,
2010
,
2011
],
"Nico"
:
[
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"PANDA-South"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Pegasus North"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
],
"Pegasus South"
:
[
2003
,
2004
,
2009
],
"Penguin Point"
:
[
2004
],
"Phoenix"
:
[
2017
,
2018
,
2019
,
2020
,
2021
,
2023
],
"Port Martin"
:
[
2003
,
2016
,
2017
],
"Possession Island"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Racer Rock"
:
[
2003
,
2004
],
"Relay Station"
:
[
2003
,
2004
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Sabrina"
:
[
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Schwerdtfeger"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Siple Dome"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Sky Blu"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
],
"Swithinbank"
:
[
2009
,
2010
,
2011
],
"Theresa"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
],
"Thurston Island"
:
[
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Tom"
:
[
2011
,
2012
,
2013
,
2014
],
"Uranus Glacier"
:
[
2003
,
2004
],
"Vito"
:
[
2004
,
2009
,
2010
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"White Island"
:
[
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Whitlock"
:
[
2003
,
2004
,
2011
,
2012
,
2013
,
2014
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Willie Field"
:
[
2003
,
2004
,
2009
,
2010
,
2012
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
],
"Windless Bight"
:
[
2003
,
2004
,
2009
,
2010
,
2011
,
2012
,
2015
,
2016
,
2017
,
2018
,
2019
,
2020
,
2021
,
2022
,
2023
]
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
visualizer/__init__.py
+
2
−
8
View file @
0d22d0e1
import
json
from
urllib.request
import
urlopen
from
flask
import
Flask
,
g
,
render_template
,
Response
from
flask
import
Flask
,
g
,
render_template
,
Response
from
.data
import
res_queried_data
from
.data
import
get_station_years
,
res_queried_data
from
.parameters
import
get_param
from
.parameters
import
get_param
with
open
(
'
station-years.json
'
)
as
f
:
station_years
=
json
.
load
(
f
)
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
app
.
jinja_env
.
trim_blocks
=
True
app
.
jinja_env
.
trim_blocks
=
True
...
@@ -30,7 +24,7 @@ def plot_embed():
...
@@ -30,7 +24,7 @@ def plot_embed():
def
render_plotter
(
embedded
):
def
render_plotter
(
embedded
):
g
.
embedded
=
embedded
g
.
embedded
=
embedded
g
.
station_years
=
station_years
g
.
station_years
=
get_
station_years
()
return
render_template
(
'
plotter.html
'
)
return
render_template
(
'
plotter.html
'
)
...
...
This diff is collapsed.
Click to expand it.
visualizer/data.py
+
5
−
0
View file @
0d22d0e1
...
@@ -19,6 +19,11 @@ api_cols_fields = ('date', 'time', 'temperature', 'pressure', 'wind_speed',
...
@@ -19,6 +19,11 @@ api_cols_fields = ('date', 'time', 'temperature', 'pressure', 'wind_speed',
APICols
=
namedtuple
(
'
APICols
'
,
api_cols_fields
)
APICols
=
namedtuple
(
'
APICols
'
,
api_cols_fields
)
def
get_station_years
():
with
urlopen
(
f
'
{
API_ROOT
}
/aws/list/station_years
'
)
as
f
:
return
json
.
load
(
f
)
def
res_queried_data
():
def
res_queried_data
():
station_name
=
get_param
(
'
station
'
,
to
=
station_name_type
)
station_name
=
get_param
(
'
station
'
,
to
=
station_name_type
)
year
=
get_param
(
'
year
'
,
to
=
year_type
)
year
=
get_param
(
'
year
'
,
to
=
year_type
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment