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

Endpoints for PFT details & plotting of run outputs #2665

Merged
merged 10 commits into from Jul 27, 2020

Conversation

tezansahu
Copy link
Contributor

  • Endpoints for searching & retrieving PFT details
  • Added Modeltype Formats information to the response of /api/models/{model_id}
  • Added details of run outputs to the response of api/runs/{run_id} if the outputs folder exists on the host
  • Created endpoint for plotting results of a PEcAn run

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tezansahu tezansahu self-assigned this Jul 27, 2020
@tezansahu tezansahu added the GSOC label Jul 27, 2020
if (nrow(qry_res) == 0) {
PEcAn.DB::db.close(dbcon)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to just use on.exit to specify the db.close right when you open it to make sure that close happens even if any other sort of error occurs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure...that's a good idea...will try n incorporate this for all endpoints

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is that the application does not exit, but stays open. We just need to make sure we close teh connections.

#* @get /<run_id>/graph/<year>/<y_var>
#* @serializer contentType list(type='image/png')

plotResults <- function(run_id, year, y_var, x_var="time", width=800, height=600, res){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that there's anything 'wrong' with this, but I'd say that grabbing/downloading the model output itself is going to be FAR more important to most users than downloading an image file. Probably grabbing the whole netCDF would be the best place to start, but I could see a lot of folk wanting to subset variables, locations, data ranges, and ensemble members. The latter support it built into THREDDS, but (1) not all of our PEcAn servers support THREDDS (but maybe the right thing to do is to fix that) and (2) regardless we should have some helper functions in the R package to help people download output rather than having to learn to work with THREDDS directly (which is nontrivial)

I think there's also a REALLY high need, even if it's just internal to the project, to be able to correctly grab INPUTS and POSTERIORS via the API. The former will be pretty important to a lot of enduser analyses as well (e.g. plot predicted fluxes vs meteorological inputs)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is needed in the current web application. The current web application can not create the graphs we had in the VM version. This will allow me/us to call this endpoint to get an image back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the ability to download the outputs/inputs/posteriors I agree, we just have to find the right functions, but I think we have a lot of this framework in place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, yes that makes perfect sense.
As we discussed during last week's planning meeting, we should think about whether it makes sense to rework the whole PHP interface to use the API rather than it's current approach of direct execution of R code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shhhhh, but that is my plan :) and maybe even use R and leaflet or other things.

@mdietze mdietze merged commit 142c1cd into PecanProject:develop Jul 27, 2020
@robkooper robkooper mentioned this pull request Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants