GCBM Simulation API and End-Points for upload
#152
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Description
This PR introduces a
GCBMSimulation
class, and end-pointupload
for uploading files for categories:disturbance, classifiers, miscellaneous
(disturbance is kept optional). The way to add a file usingGCBMSimulation
is:And it will generate the JSON file for you, in
templates/config/
folder.The API also makes sure to raise an error for missing categories once it’s done. For example, if you passed only disturbance and classifier files using
curl -F
command, it will raise an error like:So that the user is aware which categories they missed. For this purpose, I created an enum
REQUIRED
and corresponding to each category we have a “YES/NO” (REQUIRED.yes, REQUIRED.no
) - so, if in the future, a category’s “required” value is changed, we can just change it in theapp.py
toREQUIRED.<new_value(yes/no)>
.To support any new categories, it should be straight forward:
I took a look at the expected JSON files, I was able to add:
cell<Lat/Long>Size, block<Lat/Long>size, tile<Lat/Long>Size, nodata, layer_type, layer_data
to the JSON file. For other data in “attributes” key, like “disturbance_type”, “transition” etc. - those need to be hard-coded for each year file?TODOs:
GCBMSimulation
classFixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please see the README for any instructions on how to run the end-point. Tests will be added once all the categories have been added.
Additional Context (Please include any Screenshots/gifs if relevant)
...
Checklist:
Thanks!
Cc: @aornugent , @Namyalg, @padmajabhol, @SanjaySinghRajpoot @YashKandalkar