Skip to content

Commit

Permalink
Starting off with some boilerplate and updates to MODEL_SPEC.
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed Aug 24, 2023
1 parent 0db98d7 commit d4e34b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/natcap/invest/urban_nature_access.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import collections
import functools
import logging
import math
import os
Expand Down Expand Up @@ -80,11 +79,14 @@
'columns': {
'lucode': spec_utils.LULC_TABLE_COLUMN,
'urban_nature': {
'type': 'number',
'type': 'ratio',
'units': u.none,
'about': (
"Binary code indicating whether the LULC type is "
"(1) or is not (0) an urban nature type."
"The proportion (0-1) indicating how much of the land "
"in this LULC type is urban nature. "
"0 indicates no area this LULC type is urban nature, "
"1 indicates that this LULC type is entirely urban "
"nature."
),
},
'search_radius_m': {
Expand Down Expand Up @@ -648,9 +650,10 @@ def execute(args):
CSV with the following columns:
* ``lucode``: (required) the integer landcover code represented.
* ``urban_nature``: (required) ``0`` or ``1`` indicating whether
this landcover code is (``1``) or is not (``0``) an urban nature
pixel.
* ``urban_nature``: (required) a proportion (0-1) representing
how much of this landcover type is urban nature. ``0``
indicates none of this type's area is urban nature, ``1``
indicates all of this type's area is urban nature.
* ``search_radius_m``: (conditionally required) the search radius
for this urban nature LULC class in meters. Required for all
urban nature LULC codes if ``args['search_radius_mode'] ==
Expand Down
4 changes: 4 additions & 0 deletions tests/test_urban_nature_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,10 @@ def test_weighted_sum(self):
numpy.testing.assert_allclose(
numpy.sum(weighted_sum_array[~nodata_pixels]), 1122.5)

def test_urban_nature_proportion(self):
"""UNA: Run the model with urban nature proportion."""
from natcap.invest import urban_nature_access

def test_validate(self):
"""UNA: Basic test for validation."""
from natcap.invest import urban_nature_access
Expand Down

0 comments on commit d4e34b5

Please sign in to comment.