def start_analyze_climate(request, format=None): """ Start a job to calculate the monthly climate (precipitation and mean temperature) of a given area. Source PRISM Climate Group For more information, see the [technical documentation](https://wikiwatershed.org/ documentation/mmw-tech/#overlays-tab-coverage) ## Response You can use the url provided in the response's `location` header to poll for the job's results. <summary> **Example of a completed job's `result`** </summary> <details> { "survey": { "displayName": "Climate", "name": "climate", "categories": [ { "ppt": 66.84088134765625, "tmean": -2.4587886333465576, "monthidx": 1, "month": "January" }, { "ppt": 59.17946434020996, "tmean": -1.8310737609863281, "monthidx": 2, "month": "February" }, ... ] } } </details> --- type: job: required: true type: string status: required: true type: string omit_serializer: true parameters: - name: body description: A valid single-ringed Multipolygon GeoJSON representation of the shape to analyze. See the GeoJSON spec https://tools.ietf.org/html/rfc7946#section-3.1.7 paramType: body type: object - name: wkaoi paramType: query description: The table and ID for a well-known area of interest, such as a HUC. Format "table__id", eg. "huc12__55174" will analyze the HUC-12 City of Philadelphia-Schuylkill River. - name: Authorization paramType: header description: Format "Token YOUR_API_TOKEN_HERE". When using Swagger you may wish to set this for all requests via the field at the top right of the page. consumes: - application/json produces: - application/json """ user = request.user if request.user.is_authenticated() else None wkaoi = request.query_params.get('wkaoi', None) area_of_interest = load_area_of_interest(request.data, wkaoi) validate_aoi(area_of_interest) geotasks = [] ppt_raster = settings.GEOP['json']['ppt']['input']['targetRaster'] tmean_raster = settings.GEOP['json']['tmean']['input']['targetRaster'] for i in xrange(1, 13): ppt_input = { 'polygon': [area_of_interest], 'targetRaster': ppt_raster.format(i) } tmean_input = { 'polygon': [area_of_interest], 'targetRaster': tmean_raster.format(i) } geotasks.extend([ geoprocessing.run.s('ppt', ppt_input, wkaoi, i) | tasks.analyze_climate.s('ppt', i), geoprocessing.run.s('tmean', tmean_input, wkaoi, i) | tasks.analyze_climate.s('tmean', i) ]) return start_celery_job([ group(geotasks), tasks.collect_climate.s(), ], area_of_interest, user, link_error=False)
def start_analyze_catchment_water_quality(request, format=None): """ Starts a job to calculate the calibrated GWLF-E (MapShed) model estimates for a given area (Delaware River Basin only) Source Stream Reach Tool Assessment (SRAT) For more information, see the [technical documentation](https://wikiwatershed.org/ documentation/mmw-tech/#overlays-tab-coverage) ## Response you can use the url provided in the response's `location` header to poll for the job's results. <summary> **example of a completed job's `result`** </summary> <details> { "survey": { "displayname": "water quality", "name": "catchment_water_quality", "categories": [ { "tss_urban_": 49.115354321566734, "tn_riparia": 0.3730090214, "tn_pt_kgyr": null, "tp_urban_k": 0.5043825, "tss_tot_kg": 336.49653266840215, "geom": { "type": "multipolygon", "coordinates": [ [ [ [ -74.9780151302813, 40.0646039341582 ], ... ], ... ] ] }, "nord": 4793, "tss_concmg": 124.5634, "tp_ag_kgyr": 0.493174, "tp_yr_avg_": 0.0929, "tn_yr_avg_": 1.461, "tn_ag_kgyr": 8.74263, "tss_natura": 3.912097242622951, "tp_pt_kgyr": null, "tn_natural": 2.622789, "areaha": 375.27, "tp_tot_kgy": 0.51148576021895, "tn_urban_k": 8.428792, "tp_natural": 0.0560425, "tp_riparia": 0.1240888899, "tn_tot_kgy": 7.745244945328085, "tss_ag_kgy": 66.71350648852459, "tss_rip_kg": 545.9289658316266 } ] } } </details> --- type: job: required: true type: string status: required: true type: string omit_serializer: true parameters: - name: body description: A valid single-ringed Multipolygon GeoJSON representation of the shape to analyze. See the GeoJSON spec https://tools.ietf.org/html/rfc7946#section-3.1.7 paramType: body type: object - name: wkaoi paramType: query description: The table and ID for a well-known area of interest, such as a HUC. Format "table__id", eg. "huc12__55174" will analyze the HUC-12 City of Philadelphia-Schuylkill River. - name: Authorization paramType: header description: Format "Token YOUR_API_TOKEN_HERE". When using Swagger you may wish to set this for all requests via the field at the top right of the page. consumes: - application/json produces: - application/json """ user = request.user if request.user.is_authenticated() else None wkaoi = request.query_params.get('wkaoi', None) area_of_interest = load_area_of_interest(request.data, wkaoi) validate_aoi(area_of_interest) return start_celery_job( [tasks.analyze_catchment_water_quality.s(area_of_interest)], area_of_interest, user)
def start_analyze_pointsource(request, format=None): """ Starts a job to analyze the discharge monitoring report annual averages for a given area. Source EPA NPDES For more information, see the [technical documentation](https://wikiwatershed.org/ documentation/mmw-tech/#additional-data-layers) ## Response You can use the URL provided in the response's `Location` header to poll for the job's results. <summary> **Example of a completed job's `result`** </summary> <details> { "survey": { "displayName": "Point Source", "name": "pointsource", "categories": [ { "city": "PHILADELPHIA", "kgp_yr": 16937.8, "mgd": 4.0835, "npdes_id": "0011533", "longitude": -75.209722, "state": "PA", "facilityname": "GIRARD POINT PROCESSING AREA", "latitude": 39.909722, "kgn_yr": 1160.76 } ], ... } } </details> --- type: job: required: true type: string status: required: true type: string omit_serializer: true parameters: - name: body description: A valid single-ringed Multipolygon GeoJSON representation of the shape to analyze. See the GeoJSON spec https://tools.ietf.org/html/rfc7946#section-3.1.7 paramType: body type: object - name: wkaoi description: The table and ID for a well-known area of interest, such as a HUC. Format "table__id", eg. "huc12__55174" will analyze the HUC-12 City of Philadelphia-Schuylkill River. - name: Authorization paramType: header description: Format "Token YOUR_API_TOKEN_HERE". When using Swagger you may wish to set this for all requests via the field at the top right of the page. consumes: - application/json produces: - application/json """ user = request.user if request.user.is_authenticated() else None wkaoi = request.query_params.get('wkaoi', None) area_of_interest = load_area_of_interest(request.data, wkaoi) validate_aoi(area_of_interest) return start_celery_job([tasks.analyze_pointsource.s(area_of_interest)], area_of_interest, user)
def start_analyze_animals(request, format=None): """ Starts a job to produce counts for animals in a given area. Source USDA For more information, see the [technical documentation](https://wikiwatershed.org/documentation/ mmw-tech/#additional-data-layers) ## Response You can use the URL provided in the response's `Location` header to poll for the job's results. <summary> **Example of a completed job's `result`** </summary> <details> { "survey": { "displayName": "Animals", "name": "animals", "categories": [ { "aeu": 0, "type": "Sheep" }, { "aeu": 0, "type": "Horses" }, { "aeu": 0, "type": "Turkeys" }, { "aeu": 0, "type": "Chickens, Layers" }, { "aeu": 0, "type": "Cows, Beef" }, { "aeu": 0, "type": "Pigs/Hogs/Swine" }, { "aeu": 0, "type": "Cows, Dairy" }, { "aeu": 0, "type": "Chickens, Broilers" } ] } } </details> --- type: job: required: true type: string status: required: true type: string omit_serializer: true parameters: - name: body description: A valid single-ringed Multipolygon GeoJSON representation of the shape to analyze. See the GeoJSON spec https://tools.ietf.org/html/rfc7946#section-3.1.7 paramType: body type: object - name: wkaoi paramType: query description: The table and ID for a well-known area of interest, such as a HUC. Format "table__id", eg. "huc12__55174" will analyze the HUC-12 City of Philadelphia-Schuylkill River. - name: Authorization paramType: header description: Format "Token YOUR_API_TOKEN_HERE". When using Swagger you may wish to set this for all requests via the field at the top right of the page. consumes: - application/json produces: - application/json """ user = request.user if request.user.is_authenticated() else None wkaoi = request.query_params.get('wkaoi', None) area_of_interest = load_area_of_interest(request.data, wkaoi) validate_aoi(area_of_interest) return start_celery_job([tasks.analyze_animals.s(area_of_interest)], area_of_interest, user)
def start_analyze_soil(request, format=None): """ Starts a job to produce a soil-type histogram for a given area. Uses the Hydrologic Soil Groups From USDA gSSURGO 2016 For more information, see the [technical documentation](https://wikiwatershed.org/ documentation/mmw-tech/#overlays-tab-coverage). ## Response You can use the URL provided in the response's `Location` header to poll for the job's results. <summary> **Example of a completed job's `result`** </summary> <details> { "survey": { "displayName": "Soil", "name": "soil", "categories": [ { "code": "a", "type": "A - High Infiltration", "coverage": 0.000010505194818837915, "area": 897.253981351988 }, { "code": "b", "type": "B - Moderate Infiltration", "coverage": 0.036474036411005245, "area": 3115265.8232541024 }, { "code": "c", "type": "C - Slow Infiltration", "coverage": 0.9465810843462092, "area": 80847967.24370223 }, { "code": "d", "type": "D - Very Slow Infiltration", "coverage": 0.00012606233782605497, "area": 10767.047776223857 }, { "code": "ad", "type": "A/D - High/Very Slow Infiltration", "coverage": 0, "area": 0 }, { "code": "bd", "type": "B/D - Medium/Very Slow Infiltration", "coverage": 0.0017753779243836077, "area": 151635.92284848596 }, { "code": "cd", "type": "C/D - Medium/Very Slow Infiltration", "coverage": 0.015032933785757057, "area": 1283970.4473146948 } ] } } </details> --- type: job: required: true type: string status: required: true type: string omit_serializer: true parameters: - name: body description: A valid single-ringed Multipolygon GeoJSON representation of the shape to analyze. See the GeoJSON spec https://tools.ietf.org/html/rfc7946#section-3.1.7 paramType: body type: object - name: wkaoi description: The table and ID for a well-known area of interest, such as a HUC. Format "table__id", eg. "huc12__55174" will analyze the HUC-12 City of Philadelphia-Schuylkill River. type: string paramType: query - name: Authorization paramType: header description: Format "Token YOUR_API_TOKEN_HERE". When using Swagger you may wish to set this for all requests via the field at the top right of the page. consumes: - application/json produces: - application/json """ user = request.user if request.user.is_authenticated() else None wkaoi = request.query_params.get('wkaoi', None) area_of_interest = load_area_of_interest(request.data, wkaoi) validate_aoi(area_of_interest) geop_input = {'polygon': [area_of_interest]} return start_celery_job([ geoprocessing.run.s('soil', geop_input, wkaoi), tasks.analyze_soil.s(area_of_interest) ], area_of_interest, user)
def start_analyze_land(request, format=None): """ Starts a job to produce a land-use histogram for a given area. Uses the National Land Cover Database (NLCD 2011) For more information, see the [technical documentation](https://wikiwatershed.org/ documentation/mmw-tech/#overlays-tab-coverage). ## Response You can use the URL provided in the response's `Location` header to poll for the job's results. <summary> **Example of a completed job's `result`** </summary> <details> { "survey": { "displayName": "Land", "name": "land", "categories": [ { "nlcd": 43, "code": "mixed_forest", "type": "Mixed Forest", "coverage": 0, "area": 0 }, { "nlcd": 71, "code": "grassland", "type": "Grassland/Herbaceous", "coverage": 0, "area": 0 }, { "nlcd": 41, "code": "deciduous_forest", "type": "Deciduous Forest", "coverage": 0, "area": 0 }, { "nlcd": 42, "code": "evergreen_forest", "type": "Evergreen Forest", "coverage": 0, "area": 0 }, { "nlcd": 11, "code": "open_water", "type": "Open Water", "coverage": 0, "area": 0 }, { "nlcd": 12, "code": "perennial_ice", "type": "Perennial Ice/Snow", "coverage": 0, "area": 0 }, { "nlcd": 81, "code": "pasture", "type": "Pasture/Hay", "coverage": 0, "area": 0 }, { "nlcd": 82, "code": "cultivated_crops", "type": "Cultivated Crops", "coverage": 0, "area": 0 }, { "nlcd": 52, "code": "shrub", "type": "Shrub/Scrub", "coverage": 0, "area": 0 }, { "nlcd": 21, "code": "developed_open", "type": "Developed, Open Space", "coverage": 0.030303030303030304, "area": 2691.709835265247 }, { "nlcd": 22, "code": "developed_low", "type": "Developed, Low Intensity", "coverage": 0.18181818181818182, "area": 16150.259011591483 }, { "nlcd": 23, "code": "developed_med", "type": "Developed, Medium Intensity", "coverage": 0.5151515151515151, "area": 45759.0671995092 }, { "nlcd": 24, "code": "developed_high", "type": "Developed, High Intensity", "coverage": 0.2727272727272727, "area": 24225.388517387222 }, { "nlcd": 90, "code": "woody_wetlands", "type": "Woody Wetlands", "coverage": 0, "area": 0 }, { "nlcd": 95, "code": "herbaceous_wetlands", "type": "Emergent Herbaceous Wetlands", "coverage": 0, "area": 0 }, { "nlcd": 31, "code": "barren_land", "type": "Barren Land (Rock/Sand/Clay)", "coverage": 0, "area": 0 } ] } } </details> --- type: job: required: true type: string status: required: true type: string omit_serializer: true parameters: - name: body description: A valid single-ringed Multipolygon GeoJSON representation of the shape to analyze. See the GeoJSON spec https://tools.ietf.org/html/rfc7946#section-3.1.7 paramType: body type: object - name: wkaoi description: The table and ID for a well-known area of interest, such as a HUC. Format "table__id", eg. "huc12__55174" will analyze the HUC-12 City of Philadelphia-Schuylkill River. type: string paramType: query - name: Authorization paramType: header description: Format "Token YOUR_API_TOKEN_HERE". When using Swagger you may wish to set this for all requests via the field at the top right of the page. consumes: - application/json produces: - application/json """ user = request.user if request.user.is_authenticated() else None wkaoi = request.query_params.get('wkaoi', None) area_of_interest = load_area_of_interest(request.data, wkaoi) validate_aoi(area_of_interest) geop_input = {'polygon': [area_of_interest]} return start_celery_job([ geoprocessing.run.s('nlcd', geop_input, wkaoi), tasks.analyze_nlcd.s(area_of_interest) ], area_of_interest, user)