GithubHelp home page GithubHelp logo

python-maprooms's People

Contributors

aaron-kaplan avatar ikhomyakov avatar kgraaf avatar nitinmagima avatar remicousin avatar xchourio avatar

Watchers

 avatar  avatar  avatar

Forkers

lebusa kgraaf

python-maprooms's Issues

Unifying widgets

Make sure that all widgets.py files are in sync with the new changes being made to the lms-monthly and onset maprooms.

Includes renaming of the file and some functions, adding new parameters within functions.

Also removing ison parameter from Block() to follow comment made my Aaron:

"I see. Here's where that's used. I think we should conditionally include/exclude the Block from the list in that case, instead of always including it but sometimes hiding it. (That requires a PR in the python-maprooms repo). And then remove the ison parameter from Block."

Rename parameter for cess date functions

Brought up by Remi, a naming convention for cessation date that is currently misleading.

Original comment:
"that is unfortunate naming as, compared to onset, it resembles the _spell_length Parameters, wheras min_dry_days, in onset, is something else... Can fix that in another PR."

Originally posted by @remicousin in #87 (comment)

Bug in set_colorbar callback

When option selected is 'pe' there is the error

AttributeError: module 'pingrid' has no attribute 'CORRELATION_COLORMAP_KEY'

Editing the key to match the pingrid file var which is, 'CORRELATION_COLORMAP then throws:

TypeError: to_dash_colorscale() got an unexpected keyword argument 'thresholds'

I have not finished debugging since I found this while working on something else, so I put it in this issue for now and will open a separate PR with the fix.

More robust and flexible handling of CPT datasets and files

Besides issue #174 , there is probably more to do to split what's purely date formatting, what's purely CPT files reading... etc... and to be robust and flexible enough to cover yet another set of files that might be written differently (even though we might not be that far).

Remove copies of widgets.py

widgets.py has been copied to multiple maprooms, and sometimes edited. Harmonize the differences and use symlink as for pingrid.py, or package as a library.

Eliminate import-time data loading

First we eliminated import-time data loading by introducing "dummy" callbacks that ignore their inputs. Then we eliminated those by initializing the app with a layout function instead of a layout. But that approach ended up making way more db queries than expected, so we reverted to calling the layout function (and thus loading data) at import time. Need to either stop the layout function from being called so many times, or revert to using dummy callbacks.

Affects subseasonal forecast and onset maprooms.

These callbacks ignore their input. If the technique I suggested for eliminating these from the seasonal maproom works, apply it here too.

Originally posted by @aaron-kaplan in #85 (comment)

Add exception handling for onset outputs with all NaTs

Need to add an except block in the dash callback to handle an error that occurs when the coordinates chosen are included in the ds, but do not have any data (all NaNs).

The exception should function to check the output of the onset function, and return an error message if the output is all NaTs.

Make it easier to plot a continuous function

discussion

Other plotting libraries I've used can plot a continuous function, automatically sampling at whatever resolution is appropriate for the figure being generated. I just searched and couldn't find anything like that for plotly, though.

Better name for daily_tobegroupedby_season

I always have to return to the source code of this function to remind myself what it does, because the name doesn't remind me. Can we rename it something like add_seasons, label_seasons, extract_seasons, ...?

(Possibly a moot point eventually, if we switch to the approach of making season year a separate dimension.)

Originally posted by @aaron-kaplan in #87 (comment)

Change camelCase to snake_case

    @drewmresnick variable names in python traditionally use `snake_case`, not `camelCase`. On a one-person project it doesn't really make a difference, but in a project with multiple people contributing it's good to have conventions so things don't get too inconsistent.

In JavaScript it's traditional to use camelCase, and dash is a python wrapper around some JavaScript libraries, so in a dash project you may see camelCase bleeding into python code in some places. But in our own code, we should stick to snake_case.

I've not been too strict about this so far because I didn't want to get too nitpicky, but it's becoming apparent that if I don't start enforcing it now then it's going to get harder and harder to do later.

Originally posted by @aaron-kaplan in #187 (comment)

Move read_cptdataset into separate predictions.py function file

Possibly... or make it an issue. The key here is that is we are going to use the same app for other cpt forecasts (biweekly, seasonal...) so all the functions associated with reading will either have to be more fancy to accommodate different cases, or have counterparts for the different cases, and the config file will tell which case we're in.
I am just not sure what shape that will all take as I review this now. So it may make sense to leave to other PR.

Originally posted by @remicousin in #156 (comment)

Assuming the user and the developer are different people, this is an error that the user can't fix, so I would put the diagnostic information in the log file rather than the browser. For now, we do that either by raising an exception or with a simple `print`.

    Assuming the user and the developer are different people, this is an error that the user can't fix, so I would put the diagnostic information in the log file rather than the browser. For now, we do that either by raising an exception or with a simple `print`.

Originally posted by @aaron-kaplan in #207 (comment)

Flexible forecast Maproom offers controls to select S/L

The subseasonal version of this Maproom has been merged to master. At present, I don't think there is anything in it that makes it specific to subseasonal (would work same way as for seasonal), except the datafiles reading and the retrieval and printing of S, L, target date in the app.

The next step is to have the app offer more than one S/L to viz'. The sample config file points to a folder where there is a set of S/Ls and can be used to try and set that up. Even though we don't have a sample of files for seasonal forecasts, setting up the subseasonal case should be done trying to be ready to work as well for the seasonal one.

Unnecessarily long shape transformation pipeline

This function retrieves shapes from postgis in wkb form, and then uses shapely to convert from wkb to geojson, which is what leaflet expects. Shapely seems unnecessary here, because postgis can generate geojson directly. Try replacing ST_AsBinary with ST_AsGeoJSON in the query (which is in the config file) and replacing lines 124-129 with

return {"features": df["the_geom"]}

Originally posted by @aaron-kaplan in #85 (comment)

Make map marker update in own callback

Unrelated to Drew's changes, I notice that when you click on the map, the location of the marker doesn't get updated until the graphs finish rendering. Could we update the marker in a separate callback instead of piggybacking it on local_plots?

Originally posted by @aaron-kaplan in #156 (comment)

Fix outputs for old onset algorithm in maproom

Upon further investigation, the plot and table produced through ingrid are not updating (seem to be static values).

In order to compare the outputs of the new and old onset functions this must be fixed so they are properly updating.

cessation date poe graph bug

In onset maproom, the cessation date probability of exceedence graph sometimes shows a spurious point in the middle so there is something wrong here. Note that subseas flex forecast also computes prob. of exceedence but possibly is doing more than is needed here, but might still be an inspiration to fix the problem

Make funcs to manipulate time in subs maproom

    In light of previous comments above. There might be a need to have a set of functions that manipulate time. We need:
  1. functions that are given the strftime format of file names and convert that in datetime objects;
  2. functions that manipulate the different datetime objects, for instance to retrieve target_start and target_end from issue and lead
  3. functions that print our datetime objects in strftime formats we want in the app at various locations.

I am not pretending I have the solution but hopefully it helps rationalize the whole set.

Originally posted by @remicousin in #187 (comment)

coord/dim/axis conventions

I wrote a bunch of code relying on xarray but ignoring xarray's functions default behavior on those (coords/dim/axis). I also consistently used time_coord="T" as the parameter for time dimension, but it turns out xarray typically talks about dim and axis rather than coord in their function. I wonder if I should harmonize all that.

Print all boundary info on hover & click for onset maproom

I'd think we should be able to accommodate both independently. Checkboxes to control the different layers of admin on one hand. On the other hand, infer name of the of the smallest level admin the mouse is hovering, even if that level is not a currently checked layer. In almost all admin databases, they contain the name of the geometries and the names of the higher levels they belong, so one can get the full information by querying the smallest admin level and print e.g. name3, name2, name1. There will be cases when name2, name1 are not there... We'll have to deal with these as exceptions somehow.

(The piece of code generating that will likely be reusable for the other item Aaron was mentioning: print that same information along with the graphs when clicking a gridbox, as Ingrid/uicore does.)

As to where to print the information when mousing over... I don't know. I agree that it's not great to obstruct the map with a pop-up. On the other hand, since it's meant to help figuring out where to click, it's convenient that it would be by the mouse... Maybe the bottom right corner of the map (by the "Leaflet" mark)? or right above or right below the map?

Sorry I feel like we are often make you redo things a good deal. Maybe we should have brief discussions before starting projects... On the other hand, doing something and then change to something else means more things done, thus more learning...

Originally posted by @remicousin in #171 (comment)

Confusion about Ingrid colormap representation

Turns out that out of the 4 cases I ran into: fbf's Ingrid colormap's representation; correlationcolorscale and the 2 PoE colorscales (once static); only the fbf's one has Ingrid's colormap returns something that corresponds to what start/endcolormap states. In the 3 other cases, colors order were switched, and/or replaced, and/or additional incrementations/sequencing were added...

I didn't understand this. If you want me to help look into it, please provide more details. I think we can merge this in the meantime.

Originally posted by @aaron-kaplan in #113 (comment)

Simplified geometry reading

    > I commented

df["the_geom"] = df["the_geom"].apply(lambda x: wkb.loads(x.tobytes()))
df["the_geom"] = df["the_geom"].apply(
lambda x: x if isinstance(x, MultiPolygon) else MultiPolygon([x])
)

and got an error right away so restored it.

I didn't mean for you to delete the wkb.loads line, only the following ones. Not important right now. I will test on devi.

Originally posted by @aaron-kaplan in #223 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.