-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plug timeline into pipeline #39
Changes from 17 commits
5b534c6
7a870eb
fbfd6e0
7a0daa5
9e8919e
56f26e4
f658ad5
07333f5
9914c06
c9dca03
d166d0d
79cecf1
bf4bb65
d954898
cbc0815
3cf86f1
a6de9c8
fb7550c
3bbb3ce
e379f32
ef861e8
d2056b8
e2750ad
a07ccd9
4a529b5
b951de9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,26 +19,19 @@ targets: | |
|
||
3_visualize: | ||
depends: | ||
- 3_visualize/out/anomaly_peaks.svg | ||
- src/assets/anomaly_peaks.svg | ||
- public/gw_sites.csv | ||
- public/date_peaks.csv | ||
- src/assets/anomaly_peaks.svg | ||
- public/gw_sites.csv ## this is in aws as gw-conditions-sites.csv | ||
- public/gw-conditions-wy20.csv ## in aws as gw-conditions-wy20.csv | ||
- public/gw-conditions-daily-count.csv ## in aws as gw-conditions-daily-count.csv | ||
|
||
3_visualize/out/anomaly_peaks.svg: | ||
# exports that are leveraged by vue | ||
src/assets/anomaly_peaks.svg: | ||
command: build_peaks_svg( | ||
target_name, | ||
data_in = gw_anomaly_data_w_colors, | ||
sites_sf = gw_sites_sf, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You took out these two arguments but the function itself, still has these included in its definition. |
||
svg_width = svg_width, | ||
svg_height = svg_height) | ||
|
||
src/assets/anomaly_peaks.svg: | ||
command: file.copy( | ||
to = target_name, | ||
from = '3_visualize/out/anomaly_peaks.svg', | ||
overwrite = TRUE) | ||
|
||
public/date_peaks.csv: | ||
public/gw-conditions-wy20.csv: | ||
command: gwl_to_peak( | ||
target_name, | ||
gw_anomaly_data_w_colors) | ||
|
@@ -47,9 +40,10 @@ targets: | |
command: get_site_coords( | ||
target_name, | ||
sites_sf = gw_sites_sf) | ||
public/gwl_daily_count.csv: | ||
|
||
public/gw-conditions-daily-count.csv: | ||
command: site_prop_timeseries(target_name, | ||
gw_anomaly_data_w_colors) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,9 @@ | ||
|
||
build_peaks_svg <- function(out_file, data_in, sites_sf, svg_width, svg_height) { | ||
build_peaks_svg <- function(out_file, svg_width, svg_height) { | ||
|
||
svg_root <- init_svg(viewbox_dims = c(0, 0, svg_width=svg_width, svg_height=svg_height)) | ||
|
||
add_background_map(svg_root, svg_width = svg_width, outline_states = FALSE) | ||
|
||
# Add spark line within group per site | ||
|
||
# TODO: THIS ONLY WORKS FOR A SINGLE DAY RIGHT NOW. I CHOSE OCT 31, 2019 | ||
# TODO: Blanket removing any path with an NA in it. There is a smarter way | ||
# to do this but will come back to that. | ||
data_in <- data_in %>% | ||
filter(Date == as.Date("2019-10-31")) %>% | ||
filter(!grepl("NA", path)) | ||
|
||
sites <- sites_sf %>% pull(site_no) %>% unique | ||
for(s in sites) { | ||
site_coords_svg <- sites_sf %>% | ||
filter(site_no == s) %>% | ||
convert_coords_to_svg(svg_width = svg_width, view_bbox = st_bbox(generate_usa_map_data())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So you are no longer using the SVG with the sites already included? You are adding via D3? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I left some notes about that here #18 (comment) I think it's worth returning to this to draw the initial map from the pipeline, and then grab those paths with D3 for the animation. I was hitting some blocks with how it was set up though due to missing sites when there wasn't data on the first day, and the way I was modifying them with D3 (was creating duplicate elements). This PR addresses those issues but is slower to load. |
||
|
||
gw_data_s <- data_in %>% filter(site_no == s) | ||
|
||
# Spark lines centered at GW location | ||
svg_root %>% | ||
add_grp(grp_nm = s, trans_x = site_coords_svg$x, | ||
trans_y = site_coords_svg$y) %>% | ||
xml_add_child("path", | ||
class = sprintf('gwl_%s', s), | ||
style = sprintf("stroke: none; fill: %s; fill-opacity: 50%%", gw_data_s$color), | ||
d = gw_data_s$path) | ||
|
||
} | ||
|
||
xml2::write_xml(svg_root, file = out_file) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Global site tag (gtag.js) - Google Analytics --> | ||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-MK065DF5XP"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); | ||
|
||
gtag('config', 'G-MK065DF5XP'); | ||
</script> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
|
@@ -11,18 +20,18 @@ | |
<%= VUE_APP_TITLE %> | ||
</title> | ||
<meta name="title" content="U.S. Groundwater Conditions"> | ||
<meta name="description" content=""> | ||
<meta name="description" content="The low down on flow down low"> | ||
<!-- Open Graph / Facebook --> | ||
<meta property="og:type" content="website"> | ||
<meta property="og:url" content="https://labs.waterdata.usgs.gov/visualizations/gw-conditions/index.html#/"> | ||
<meta property="og:title" content="U.S. Groundwater Conditions"> | ||
<meta property="og:description" content=""> | ||
<meta property="og:description" content="The low down on flow down low"> | ||
<meta property="og:image" content="https://labs.waterdata.usgs.gov/visualizations/gw-conditions/SnowToFlowMetacard.jpg"> | ||
<!-- Twitter --> | ||
<meta property="twitter:card" content="summary_large_image"> | ||
<meta property="twitter:url" content="https://labs.waterdata.usgs.gov/visualizations/gw-conditions/index.html#/"> | ||
<meta property="twitter:title" content="U.S. Groundwater Conditions"> | ||
<meta property="twitter:description" content=""> | ||
<meta property="twitter:description" content="The low down on flow down low"> | ||
<meta property="twitter:image" content="https://labs.waterdata.usgs.gov/visualizations/gw-conditions/social-tag-cards-1-1.jpg"> | ||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
<script type='application/ld+json'> | ||
|
@@ -33,7 +42,7 @@ | |
"datePublished": "FILL THIS OUT", | ||
"contributor": [ | ||
{ "@type": "Person", | ||
"name": "Colleen Nell", | ||
"name": "Cee Nell", | ||
"email": "[email protected]", | ||
"affiliation": { "@type": "Organization", "legalName": "U.S. Geological Survey" } | ||
}, | ||
|
@@ -46,7 +55,7 @@ | |
}, | ||
"audience": { "@context": "http://schema.org", "@type": "Audience", "audienceType": "General public"}, | ||
"publisher": { "@context": "http://schema.org", "@type": "Organization", "legalName": "U.S. Geological Survey" }, | ||
"keywords": "water, data viz, data visualization, groundwater" } | ||
"keywords": "water, data viz, data visualization, groundwater, animation, map" } | ||
</script> | ||
</head> | ||
<body> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
color,peak_mid,quant,path_quant | ||
#7E1900,5,Verylow,M-10 0 C -10 0 0 45 10 0 Z | ||
#C1A53A,17.5,Low,M-10 0 C -10 0 0 32 10 0 Z | ||
#8fce83,50,Normal,M-10 0 C -10 0 0 15 10 0 Z | ||
#8fce83,50,Normal,M-10 0 C -10 0 0 -15 10 0 Z | ||
#479BC5,82.5,High,M-10 0 C -10 0 0 -32 10 0 Z | ||
#1A3399,95,Veryhigh,M-10 0 C -10 0 0 -45 10 0 Z | ||
peak_mid,quant,path_quant | ||
5,Verylow,M-10 0 C -10 0 0 45 10 0 Z | ||
17.5,Low,M-10 0 C -10 0 0 32 10 0 Z | ||
50,Normal,M-10 0 C -10 0 0 15 10 0 Z | ||
50,Normal,M-10 0 C -10 0 0 -15 10 0 Z | ||
82.5,High,M-10 0 C -10 0 0 -32 10 0 Z | ||
95,Veryhigh,M-10 0 C -10 0 0 -45 10 0 Z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a comment about what is happening here and why would be very useful! After running the code and exploring, I think that these left joins effectively filter the data so that each site has values for the first day of every month in the data set.