-
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
Fix initial view #81
Fix initial view #81
Conversation
// this.d3.selectAll(".ticker-date") | ||
// .transition() | ||
// .duration(this.day_length) | ||
// .text(this.dates[start]) | ||
// .end() | ||
// .then(() => this.animateLine(start)) |
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.
Was this not getting used?
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.
Yeah, the code that adds the date ticker was already commented out, as was the end animation for it, so I commented out this piece since it's not currently being used.
src/components/GWL.vue
Outdated
this.peak_grp = map_svg.selectAll("path.gwl_glyph") | ||
.data(data, function(d) { return d ? d.key : this.class; }) // binds data based on class/key | ||
.join("path") // match with selection | ||
.attr("transform", d => `translate(` + d.site_x + ' ' + d.site_y + `) scale(0.35 0.35)`) | ||
|
||
// draws a path for each site, using the first date | ||
this.peak_grp | ||
// set up group to hold paths | ||
const peakSvgGroup = map_svg.append("g") | ||
.attr("id", "peak-map-grp") | ||
|
||
// Add path for each site, using the first date | ||
this.peak_grp = peakSvgGroup.selectAll("gwl") | ||
.data(data) | ||
.enter() | ||
.append("path") // append path for each site | ||
.attr("transform", d => `translate(` + d.site_x + ' ' + d.site_y + `) scale(0.35 0.35)`) |
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.
👍🏼
let today = d.gwl[start] == "NA" ? null : self.quant_path_gylph(d.gwl[start]) // set to null if value is NA | ||
let yesterday = d.gwl[start-1] == "NA" ? null : self.quant_path_gylph(d.gwl[start-1]) // set to null if value is NA |
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.
I did not register the difference of NA vs null
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.
Thanks for writing this out so clearly. You caught some known issues plus some 💯 . The animation ran for me and reflects what I would expect with these edits. Ends on this view:
For the last fix noted in the table, "When subset to viz period, filter out sites with no data - this dropped 5 sites" this works for now, but when we start offering multiple time periods we will need to revisit. If the sites get filtered each time frame, we'll need to have corresponding site locations and in some way ensure that the sites on the map include all sites with data. That may mean moving filtering to vue, so it can be dynamic to the user.
Somewhere before this we lost the dotted lines that delineated and labelled all the islands are territories. I'm not sure why that is.
Ooh, good point. I think I'm going to start an issue re: switching to a monthly view w/ multiple time periods, and will include this consideration there.
I noticed that, too! I'll take a poke back through and see if I can find where it dropped out |
Added back in the map labels and section lines, which I think maybe had been manually added to the R-generated svg before? I've now set them up so that they are in a separate svg, which is committed to the repo. Looks like this now: |
To keep the outer glow from being cut off at the top, I've also added in a transformation when the background map svg is written, the labels svg is overlaid, and the sites are added to the map. Now looks like this: |
sounds like something I did in a rush 😥 |
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.
Good work, Hayley. You really went above and beyond here.
Summary
This PR addresses the observed problems with the initial view and animation, discussed here in PR #79. Key problems were
The problems turned out to be tied to NA values in the data, stemming from 5 issues:
NA
GWL values being automatically assigned a path and color equivalent to 'very low'null
when data valueNA
gw-conditions-peaks-timeseries-wy22.csv
on S3 (GWL values for 1st day) was nearly entirely NA1_fetch
in order to dig into the steps in2_process
and3_visualize
1_fetch
in order to dig into the steps in2_process
and3_visualize
daily_quant
andquant_category
ofNA
because they fell outside of the historical rangeUpdated view
There are now 2211 total sites for WY22. This is the new initial view:
To run
Pull this fork to your local clone and run
npm run serve
Overview of key changes
Changes to JavaScript:
null
if the GWL value for that day for that site isNA
Changes to R pipeline:
1_fetch
,2_process
and3_visualize
in order to work in the pipeline. This re-pulled the NWIS data, and resolved the NA values on day 1 and the NA values in HI and FLNA
because the level fell outside of the historic range. I added a step incompare_to_historic
to assign the value the max or min quantile as appropriate.Additional minor changes
Other minor JavaScript changes
var
throughoutpeaky
Minor edits to the pipeline:
gw_sites_sf_shifted
default
profile name, so I think most of our team has it set up that way1_fetch
since'gw_sites.rds'
doesn't exist