diff --git a/src/mmw/apps/geoprocessing_api/schemas.py b/src/mmw/apps/geoprocessing_api/schemas.py index 006ef4a49..44fd327c5 100644 --- a/src/mmw/apps/geoprocessing_api/schemas.py +++ b/src/mmw/apps/geoprocessing_api/schemas.py @@ -192,11 +192,11 @@ ) nlcd_override_allowed_values = '", "'.join([ - 'nlcd-2019-30m-epsg5070-512-byte', - 'nlcd-2016-30m-epsg5070-512-byte', - 'nlcd-2011-30m-epsg5070-512-byte', - 'nlcd-2006-30m-epsg5070-512-byte', - 'nlcd-2001-30m-epsg5070-512-byte', + 'nlcd-2019-30m-epsg5070-512-uint8raw', + 'nlcd-2016-30m-epsg5070-512-uint8raw', + 'nlcd-2011-30m-epsg5070-512-uint8raw', + 'nlcd-2006-30m-epsg5070-512-uint8raw', + 'nlcd-2001-30m-epsg5070-512-uint8raw', 'nlcd-2011-30m-epsg5070-512-int8', ]) LAYER_OVERRIDES = Schema( @@ -209,12 +209,12 @@ properties={ '__LAND__': Schema( type=TYPE_STRING, - example='nlcd-2019-30m-epsg5070-512-byte', + example='nlcd-2019-30m-epsg5070-512-uint8raw', description='The NLCD layer to use. Valid options are: ' - f'"{nlcd_override_allowed_values}". All "-byte" ' + f'"{nlcd_override_allowed_values}". All "-uint8raw" ' 'layers are from the NLCD19 product. The "-int8" ' 'layer is from the NLCD11 product. The default value ' - 'is NLCD19 2019 "nlcd-2019-30m-epsg5070-512-byte".', + 'is NLCD19 2019 "nlcd-2019-30m-epsg5070-512-uint8raw".' ), '__STREAMS__': Schema( type=TYPE_STRING, diff --git a/src/mmw/apps/geoprocessing_api/views.py b/src/mmw/apps/geoprocessing_api/views.py index 830840ffd..9a7385d10 100644 --- a/src/mmw/apps/geoprocessing_api/views.py +++ b/src/mmw/apps/geoprocessing_api/views.py @@ -426,7 +426,7 @@ def start_analyze_land(request, nlcd_year, format=None): nlcd, year = nlcd_year.split('_') if nlcd == '2019' and year in ['2019', '2016', '2011', '2006', '2001']: - layer_overrides['__LAND__'] = f'nlcd-{year}-30m-epsg5070-512-byte' + layer_overrides['__LAND__'] = f'nlcd-{year}-30m-epsg5070-512-uint8raw' return start_celery_job([ geoprocessing.run.s('nlcd_ara', geop_input, wkaoi, diff --git a/src/mmw/apps/modeling/calcs.py b/src/mmw/apps/modeling/calcs.py index bf383863d..383588516 100644 --- a/src/mmw/apps/modeling/calcs.py +++ b/src/mmw/apps/modeling/calcs.py @@ -400,7 +400,7 @@ def get_layer_value(layer, layer_overrides=dict): If the default config is something like: { - '__LAND__': 'nlcd-2019-30m-epsg5070-512-byte', + '__LAND__': 'nlcd-2019-30m-epsg5070-512-uint8raw', '__SOIL__': 'ssurgo-hydro-groups-30m-epsg5070-512-int8', '__STREAMS__': 'nhd', } diff --git a/src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py b/src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py new file mode 100644 index 000000000..58def7406 --- /dev/null +++ b/src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py @@ -0,0 +1,45 @@ +# Generated by Django 3.2.13 on 2022-10-17 13:47 + +from django.db import migrations + + +def clear_nlcd2019_gwlfe_results(apps, schema_editor): + """ + Clear the results for all scenarios belonging to GWLF-E projects made after + the release of 1.33.0, which had incorrectly aligned NLCD19 2019 on + 2022-01-17: + https://github.com/WikiWatershed/model-my-watershed/releases/tag/1.33.0 + + These results will be recalculated with the correclty aligned NLCD19 values + when these projects are accessed again. + """ + Project = apps.get_model('modeling', 'Project') + Scenario = apps.get_model('modeling', 'Scenario') + + Project.objects.filter( + model_package='gwlfe', + created_at__gte='2022-01-17', + ).update( + gis_data=None, + mapshed_job_uuid=None, + subbasin_mapshed_job_uuid=None, + ) + + Scenario.objects.filter( + project__model_package='gwlfe', + project__created_at__gte='2022-01-17', + ).update( + results='[]', + modification_hash='', + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ('modeling', '0040_clear_nlcd2019_tr55_results'), + ] + + operations = [ + migrations.RunPython(clear_nlcd2019_gwlfe_results), + ] diff --git a/src/mmw/js/src/modeling/utils.js b/src/mmw/js/src/modeling/utils.js index bee17dd24..4d893eb29 100644 --- a/src/mmw/js/src/modeling/utils.js +++ b/src/mmw/js/src/modeling/utils.js @@ -64,11 +64,11 @@ module.exports = { layerOverrideToDefaultLandCoverType: function(layer_overrides) { var raster = layer_overrides && _.get(layer_overrides, "__LAND__"), mapping = { - "nlcd-2019-30m-epsg5070-512-byte": "land_2019_2019", - "nlcd-2016-30m-epsg5070-512-byte": "land_2019_2016", - "nlcd-2011-30m-epsg5070-512-byte": "land_2019_2011", - "nlcd-2006-30m-epsg5070-512-byte": "land_2019_2006", - "nlcd-2001-30m-epsg5070-512-byte": "land_2019_2001", + "nlcd-2019-30m-epsg5070-512-uint8raw": "land_2019_2019", + "nlcd-2016-30m-epsg5070-512-uint8raw": "land_2019_2016", + "nlcd-2011-30m-epsg5070-512-uint8raw": "land_2019_2011", + "nlcd-2006-30m-epsg5070-512-uint8raw": "land_2019_2006", + "nlcd-2001-30m-epsg5070-512-uint8raw": "land_2019_2001", "nlcd-2011-30m-epsg5070-512-int8": "land_2011_2011", }; diff --git a/src/mmw/mmw/settings/base.py b/src/mmw/mmw/settings/base.py index 5dad48c08..0f74aa8cd 100644 --- a/src/mmw/mmw/settings/base.py +++ b/src/mmw/mmw/settings/base.py @@ -478,7 +478,7 @@ def get_env_setting(setting): '__BFI__': 'bfi48grd-epsg5070', '__GWN__': 'us-groundwater-nitrogen-30m-epsg5070-512', '__KFACTOR__': 'us-ssugro-kfactor-30m-epsg5070-512', - '__LAND__': 'nlcd-2019-30m-epsg5070-512-byte', + '__LAND__': 'nlcd-2019-30m-epsg5070-512-uint8raw', '__NED__': 'ned-nhdplus-30m-epsg5070-512', '__PROTECTED_LANDS__': 'protected-lands-30m-epsg5070-512', '__SLOPE__': 'us-percent-slope-30m-epsg5070-512',