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

Add Active River Area numbers to Land analysis #3200

Merged
merged 1 commit into from Nov 8, 2019

Conversation

@rajadain
Copy link
Member

rajadain commented Nov 7, 2019

Overview

We are incorporating Active River Area analysis into the Land tab. Currently, this is tightly coupled with the endpoint in the back-end, so we incorporate it in to the NLCD analyze end-point.

The input values do not change, but the output of the endpoint now includes an active_river_area key which has the area of land under each land use which qualifies as an active river area.

This uses the same Active River Area raster which is used to visualize the layer in the layer picker.

Since now the same tab is doing both calculations, we switch to using a double RasterGroupedCount operation, which pairs the NLCD results with the Active River Area results. To get just the NLCD values as before, we sum them up ignoring the Active River Area values. The Active River Area values will be summed up on the front-end.

Connects #3199

Demo

{
  "active_river_area": 794069.7734965094,
  "area": 2862240.200512842,
  "code": "deciduous_forest",
  "coverage": 0.03351157147209295,
  "nlcd": 41,
  "type": "Deciduous Forest"
},

Testing Instructions

  • Check out this branch
  • Go to :8000/ and open the Network tab
  • Draw a shape
    • Ensure that Analyze still works, especially the Land tab
  • Inspect the network tab for the Land result
    • Ensure in the results you see active_river_area key
@rajadain rajadain added the OSI label Nov 7, 2019
@rajadain rajadain requested a review from caseycesari Nov 7, 2019
Copy link
Member

caseycesari left a comment

This is working well. Thanks for pairing on it with me yesterday.

A test needs to be updated to account for changes to the land analysis:

======================================================================
ERROR: test_survey_land (app.apps.geoprocessing_api.tests.ExerciseAnalyze)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/app/apps/geoprocessing_api/tests.py", line 278, in test_survey_land
    actual = tasks.analyze_nlcd(histogram)
  File "/usr/local/lib/python2.7/dist-packages/celery/local.py", line 191, in __call__
    return self._get_current_object()(*a, **kw)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 380, in __call__
    return self.run(*args, **kwargs)
  File "/opt/app/apps/geoprocessing_api/tasks.py", line 125, in analyze_nlcd
    for (nlcd, ara), count in result.iteritems():
TypeError: 'int' object is not iterable
We are incorporating Active River Area analysis into the Land
tab. Currently, this is tightly coupled with the endpoint in
the back-end, so we incorporate it in to the NLCD analyze end-
point.

The input values do not change, but the output of the endpoint
now includes an `active_river_area` key which has the area of
land under each land use which qualifies as an active river
area.

This uses the same Active River Area raster which is used to
visualize the layer in the layer picker.

Since now the same tab is doing both calculations, we switch
to using a double RasterGroupedCount operation, which pairs
the NLCD results with the Active River Area results. To get
just the NLCD values as before, we sum them up ignoring the
Active River Area values. The Active River Area values will
be summed up on the front-end.
@rajadain rajadain force-pushed the tt/analyze-active-river-areas branch from d18bcad to 11a4550 Nov 8, 2019
@rajadain

This comment has been minimized.

Copy link
Member Author

rajadain commented Nov 8, 2019

Thanks, fixed that and force pushed an update.

Copy link
Member

caseycesari left a comment

Tests are passing. Good to go.

@caseycesari caseycesari assigned rajadain and unassigned caseycesari Nov 8, 2019
@rajadain rajadain merged commit f8a8a0c into develop Nov 8, 2019
2 checks passed
2 checks passed
default Build finished.
Details
model-my-watershed-pull-requests Build #4112 succeeded in 9 min 1 sec
Details
@rajadain rajadain deleted the tt/analyze-active-river-areas branch Nov 8, 2019
@rajadain

This comment has been minimized.

Copy link
Member Author

rajadain commented Nov 8, 2019

Thanks for reviewing and pairing on this!

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.