Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
visualizer-synthesis
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Owen Graham
visualizer-synthesis
Commits
a7b23024
Verified
Commit
a7b23024
authored
Mar 18, 2022
by
Owen Graham
Browse files
Options
Downloads
Patches
Plain Diff
Factor out `get_link()` from plot functions
parent
44d0d0b4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
visualizer.py
+7
-10
7 additions, 10 deletions
visualizer.py
with
7 additions
and
10 deletions
visualizer.py
+
7
−
10
View file @
a7b23024
...
...
@@ -93,8 +93,7 @@ def plot_boxplot():
return
row
[
field
]
for
year
in
years
:
json_link
=
get_link
(
name
,
year
)
+
'
.jsonld
'
data
=
read_data
(
name
,
year
,
json_link
)
data
=
read_data
(
name
,
year
)
selected_data
=
data
[:,
field
]
plot_data
.
append
(
selected_data
)
...
...
@@ -125,9 +124,8 @@ def plot():
name
=
get_query
(
'
name
'
)
year
=
get_query
(
'
year
'
,
to
=
year_type
)
field
=
get_query
(
'
field
'
,
to
=
field_type
)
json_link
=
get_link
(
name
,
year
)
+
'
.jsonld
'
units
=
field_units
[
field
]
data
=
read_data
(
name
,
year
,
json_link
)
data
=
read_data
(
name
,
year
)
fig
,
axes
=
plt
.
subplots
()
fig
.
set_figheight
(
6
)
fig
.
set_figwidth
(
12
)
...
...
@@ -163,8 +161,7 @@ def plot_overlay():
return
[
row
for
row
in
rows
if
(
row
[
0
].
month
,
row
[
0
].
day
)
!=
(
2
,
29
)]
for
dset
in
datasets
:
dset
.
json_link
=
get_link
(
dset
.
name
,
dset
.
year
)
+
'
.jsonld
'
raw_data
=
read_data
(
dset
.
name
,
dset
.
year
,
dset
.
json_link
)
raw_data
=
read_data
(
dset
.
name
,
dset
.
year
)
dset
.
data
=
np
.
array
(
ignore_feb_29
(
raw_data
))
fig
,
axes
=
plt
.
subplots
()
...
...
@@ -266,8 +263,8 @@ def get_record_link():
return
get_link
(
name
,
year
)
def
get_resources
(
json_
link
):
doc
=
jsonld
.
flatten
(
json_link
)
def
get_resources
(
link
):
doc
=
jsonld
.
flatten
(
link
+
'
.jsonld
'
)
for
i
in
doc
:
types
=
i
.
get
(
'
@type
'
,
[])
if
DISTRIBUTION
not
in
types
:
...
...
@@ -284,9 +281,9 @@ def get_resources(json_link):
yield
url
def
read_data
(
name
,
year
,
json_link
):
def
read_data
(
name
,
year
):
daily_data
=
[]
resource_list
=
get_resources
(
json
_link
)
resource_list
=
get_resources
(
get
_link
(
name
,
year
)
)
for
url
in
resource_list
:
data
=
urlopen
(
url
)
if
name
==
'
South Pole Station
'
:
...
...
...
...
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
sign in
to comment