Skip to content
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

Allow callers to stats and multistats API to specify which statistics they are interested in #119

Open
corviday opened this issue Feb 6, 2020 · 1 comment

Comments

@corviday
Copy link
Contributor

corviday commented Feb 6, 2020

Currently the stats API returns a JSON object with attributes representing min, max, mean, median, stdev, and ncells values. Plan2adapt's calculations have been running slowly, and it might speed things up a bit if, when plan2adapt requested statistics, it could request only the exact statistics it needs.

Add parameter(s) to control which statistics are calculated.

@corviday
Copy link
Contributor Author

corviday commented Feb 6, 2020

@rod-glover and I discussed some possible new query designs:

  1. A parameter for the presence or absence of each statistical measure:
https://server/api/multistats?ensemble_name=ce_files&model=PCIC12
&variable=cdd&emission=historical,rcp85&time=0&timescale=seasonal
&median=true&stdev=true&min=false&mean=false&ncells=false
  1. Or just the parameter alone - any parameter that isn't present in the query won't be calculated:
https://server/api/multistats?ensemble_name=ce_files&model=PCIC12
&variable=cdd&emission=historical,rcp85&time=0&timescale=seasonal
&median&stdev
  1. A comma-separated parameter list:
https://server/api/multistats?ensemble_name=ce_files&model=PCIC12
&variable=cdd&emission=historical,rcp85&time=0&timescale=seasonal
&measure=median,stdev

We didn't much like 1, but didn't have strong feelings between 2 and 3. In theory, 3 would be harder to cache, since the parameter list would not necessarily have a consistent order, though in practice a front end will probably ask for the same values in the same order. 2 might require more complicated parameter parsing.

In all cases, not supplying the new parameter would result in receiving all six measures, as is current behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant