pacificclimate / pdp

The PCIC Data Portal - Server software to run the entire web application
GNU General Public License v3.0
1 stars 2 forks source link

Front-end colorscale bar is out of sync with WMS requests #42

Closed jameshiebert closed 7 years ago

jameshiebert commented 8 years ago

Francis has noted that on the downscaled GCMs data portal page, the color scale range goes from -61 to +47 degrees celsius, but it's displaying a map for January 2000 and showing values near the top end of the range.

screen shot 2016-09-21 at 10 07 04 am

Temperature > 20 is implausible for Vancouver Island in January, so something is up with the map.

It turns out that if you look at the WMS request headers: http://tools.pacificclimate.org/ncWMS-PCIC/wms?LAYERS=pr-tasmax-tasmin_day_BCSD-ANUSPLIN300-CanESM2_historical-rcp26_r1i1p1_19500101-21001231/tasmax&TRANSPARENT=true&STYLES=boxfill/ferret&TIME=2000-01-01&NUMCOLORBANDS=254&VERSION=1.1.1&SRS=EPSG:4326&COLORSCALERANGE=-50,11&LOGSCALE=false&SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&BBOX=-129.375,52.03125,-127.96875,53.4375&WIDTH=512&HEIGHT=512 the COLORSCALE range is fixed at something different (-50 to 11) than the values of the scale bar.

If I recall correctly, the COLORSCALE range is hardcoded (here) because people wanted to see some spatial variation on the map (rather than fixing the range to be the full range of the dataset and then having a small range show up for a single time step). But this is a little schizophrenic: we need to use the same approach (fully dynamic, or fully hard-codeded) for both the WMS params and the colorscale bar. Otherwise, they'll continue to be out of sync.

Action on this ticket requires deciding on the approach and then implementing it.

basilveerman commented 8 years ago

I think I accounted for this in the climate-explorer-frontend... can't quite remember.

Check out: https://github.com/pacificclimate/climate-explorer-frontend/blob/master/src/core/leaflet-ncwms-colorbar.js#L86. If COLORSCALERANGE is set on the layer, use it, else the map must be using the default values, so query ncWMS for them.

If that checks out, it would probably be appropriate to replace all the scalebars in the pdp with that leaflet control. You can see it instantiated here.

ps. Oh hi!!

jameshiebert commented 8 years ago

Hello ghost of Basil! :) Thanks for voluntarily chiming in (would you prefer to be removed from the project so you don't get random notifications that are irrelevant to your current work?)

Yes, I agree that using the leaflet control from the Climate Explorer is the better long-term solution. @CBMasri will be working on the pdp code this term and componentizing it (make everything into ReactJS components and replacing OpenLayers with Leaflet).

In the mean time, though, we'll probably want a hotfix that just fixes the issue at hand (and doesn't replace the whole mapping infrastructure). I think that @mdfischer should be able to take that on.

basilveerman commented 8 years ago

I'm OK with getting updates. Kinda fun actually. An hey, maybe I'll actually help out now and then :P.

Totally forgot about Leaflet/Openlayers divide, so yeah, can't use the control. They are both instantiated with the ncwms layer though, so the same logic could be copied in.

Have fun!