-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix sampling endpoint by removing region setting, because actinia users have a cell limit * Add required GRASS GIS addon to README.md * adding some examples * fix some tests Co-authored-by: anikaweinmann <[email protected]>
- Loading branch information
1 parent
0ece9e4
commit e249d35
Showing
23 changed files
with
310 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM mundialis/actinia-core:latest as actinia_test | ||
FROM mundialis/actinia:latest as actinia_test | ||
|
||
LABEL authors="Carmen Tawalika,Anika Weinmann" | ||
LABEL maintainer="[email protected],[email protected]" | ||
|
@@ -18,10 +18,10 @@ RUN wget --quiet https://grass.osgeo.org/sampledata/north_carolina/nc_spm_08_mic | |
rm -f nc_spm_08_micro.zip && \ | ||
mv nc_spm_08_micro /actinia_core/grassdb/nc_spm_08 | ||
RUN grass -e -c 'EPSG:4326' /actinia_core/grassdb/latlong_wgs84 | ||
RUN wget --quiet https://grass.osgeo.org/sampledata/north_carolina/nc_spm_mapset_modis2015_2016_lst.zip && \ | ||
unzip nc_spm_mapset_modis2015_2016_lst.zip && \ | ||
rm -f nc_spm_mapset_modis2015_2016_lst.zip && \ | ||
mv modis_lst /actinia_core/grassdb/nc_spm_08/modis_lst | ||
RUN wget --quiet https://grass.osgeo.org/sampledata/north_carolina/nc_spm_mapset_modis2015_2016_lst_grass8.zip && \ | ||
unzip nc_spm_mapset_modis2015_2016_lst_grass8.zip && \ | ||
rm -f nc_spm_mapset_modis2015_2016_lst_grass8.zip && \ | ||
mv modis_lst /actinia_core/grassdb/nc_spm_08/modis_lst | ||
RUN chown -R 1001:1001 /actinia_core/grassdb/nc_spm_08/modis_lst && chmod -R g+w /actinia_core/grassdb/nc_spm_08/modis_lst | ||
|
||
# copy needed files and configs for test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"type": "FeatureCollection", | ||
"crs": { | ||
"type": "name", | ||
"properties": {"name": "urn:x-ogc:def:crs:EPSG:3358"} | ||
}, | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": {"fid": "test"}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[330000.0, 65000.0], | ||
[337000.0, 65000.0], | ||
[337000.0, 647000.0], | ||
[330000.0, 647000.0], | ||
[330000.0, 65000.0] | ||
] | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"type": "FeatureCollection", | ||
"crs": { | ||
"type": "name", | ||
"properties": {"name": "urn:x-ogc:def:crs:EPSG:3358"} | ||
}, | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": {"fid": "test"}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[635000.0, 220000.0], | ||
[637000.0, 220000.0], | ||
[637000.0, 221000.0], | ||
[635000.0, 221000.0], | ||
[635000.0, 220000.0] | ||
] | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Examples | ||
``` | ||
BASE_URL="http://localhost:8088/api/v3" | ||
AUTH='actinia-gdi:actinia-gdi' | ||
``` | ||
|
||
## STRDS sampling | ||
|
||
Sampling STRDS at point coordinates | ||
``` | ||
# async | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/modis_lst/strds/LST_Day_monthly/sampling_async -d @points.json | ||
# sync | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/modis_lst/strds/LST_Day_monthly/sampling_sync -d @points.json | ||
``` | ||
|
||
Sampling STRDS at point coordinates by filtering the time of the STRDS | ||
``` | ||
# async | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/modis_lst/strds/LST_Day_monthly/sampling_async -d @points_where.json | ||
# sync | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/modis_lst/strds/LST_Day_monthly/sampling_sync -d @points_where.json | ||
``` | ||
|
||
Sampling STRDS at Points in a GeoJson | ||
``` | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/modis_lst/strds/LST_Day_monthly/sampling_sync_geojson -d @points.geojson | ||
``` | ||
|
||
Sampling STRDS by area | ||
``` | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/modis_lst/strds/LST_Day_monthly/timestamp/2016-01-01T00:00:00/area_stats_sync -d @area.geojson | ||
``` | ||
|
||
## Raster sampling | ||
Raster statistics of area | ||
``` | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/PERMANENT/raster_layers/landuse96_28m/area_stats_sync -d @area2.geojson | ||
``` | ||
|
||
Univar raster statistics of area | ||
``` | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/PERMANENT/raster_layers/elevation/area_stats_univar_sync -d @area2.geojson | ||
``` | ||
|
||
|
||
## Vector sampling | ||
``` | ||
curl -u ${AUTH} -H 'Content-Type: application/json' -X POST ${BASE_URL}/locations/nc_spm_08/mapsets/PERMANENT/vector_layers/nc_state/sampling_async -d @points2.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"type": "FeatureCollection", "crs": {"type": "name", "properties": {"name": "urn:x-ogc:def:crs:EPSG:3358"}}, "features": [{"type": "Feature", "properties": {"cat": 1}, "geometry": {"type": "Point", "coordinates": [330000.0, 65000.0]}}, {"type": "Feature", "properties": {"cat": 2}, "geometry": {"type": "Point", "coordinates": [500000.0, 500000.0]}}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"points": [["a", "330000.0", "65000.0"], ["b", "300000.0", "60000.0"], ["c", "500000.0", "500000.0"]]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"points": [["p1", "330000.0", "65000.0"],["p2", "331000.0", "649000.0"]]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"points": [["a", "330000.0", "65000.0"], ["b", "300000.0", "60000.0"], ["c", "500000.0", "500000.0"]], "where": "start_time >'2016-01-01'"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,14 @@ | |
from test_resource_base import ActiniaResourceTestCaseBase, URL_PREFIX | ||
|
||
__license__ = "GPLv3" | ||
__author__ = "Sören Gebbert" | ||
__copyright__ = "Copyright 2016, Sören Gebbert" | ||
__maintainer__ = "Soeren Gebbert" | ||
__email__ = "[email protected]" | ||
|
||
__author__ = "Sören Gebbert, Anika Weinmann" | ||
__copyright__ = "Copyright 2016-2022, Sören Gebbert and mundialis GmbH & Co.KG" | ||
__maintainer__ = "mundialis GmbH & Co. KG" | ||
|
||
LOCATION = "nc_spm_08" | ||
MAPSET = "PERMANENT" | ||
RASTER = "landuse96_28m" | ||
RASTER2 = "basin_50K" | ||
JSON = { | ||
"type": "FeatureCollection", | ||
"crs": { | ||
|
@@ -45,8 +48,8 @@ | |
class RasterAreaStatsTestCase(ActiniaResourceTestCaseBase): | ||
def test_async_raster_area_stats_json(self): | ||
rv = self.server.post( | ||
f"{URL_PREFIX}/locations/nc_spm_08/mapsets/PERMANENT/raster_layers" | ||
"/landuse96_28m/area_stats_async", | ||
f"{URL_PREFIX}/locations/{LOCATION}/mapsets/{MAPSET}/raster_layers" | ||
f"/{RASTER}/area_stats_async", | ||
headers=self.admin_auth_header, | ||
data=json_dump(JSON), | ||
content_type="application/json", | ||
|
@@ -60,8 +63,8 @@ def test_async_raster_area_stats_json(self): | |
|
||
def test_sync_raster_area_stats_1(self): | ||
rv = self.server.post( | ||
f"{URL_PREFIX}/locations/nc_spm_08/mapsets/PERMANENT/raster_layers" | ||
"/landuse96_28m/area_stats_sync", | ||
f"{URL_PREFIX}/locations/{LOCATION}/mapsets/{MAPSET}/raster_layers" | ||
f"/{RASTER}/area_stats_sync", | ||
headers=self.admin_auth_header, | ||
data=json_dump(JSON), | ||
content_type="application/json", | ||
|
@@ -82,8 +85,8 @@ def test_sync_raster_area_stats_1(self): | |
def test_sync_raster_area_stats_2(self): | ||
|
||
rv = self.server.post( | ||
f"{URL_PREFIX}/locations/nc_spm_08/mapsets/PERMANENT/raster_layers" | ||
"/basin_50K/area_stats_sync", | ||
f"{URL_PREFIX}/locations/{LOCATION}/mapsets/{MAPSET}/raster_layers" | ||
f"/{RASTER2}/area_stats_sync", | ||
headers=self.admin_auth_header, | ||
data=json_dump(JSON), | ||
content_type="application/json", | ||
|
@@ -103,8 +106,8 @@ def test_sync_raster_area_stats_2(self): | |
|
||
def test_sync_raster_area_stats_error_wrong_content_type(self): | ||
rv = self.server.post( | ||
f"{URL_PREFIX}/locations/nc_spm_08/mapsets/PERMANENT/raster_layers" | ||
"/basin_50K/area_stats_sync", | ||
f"{URL_PREFIX}/locations/{LOCATION}/mapsets/{MAPSET}/raster_layers" | ||
f"/{RASTER}/area_stats_sync", | ||
headers=self.admin_auth_header, | ||
data="{}", | ||
content_type="application/json", | ||
|
@@ -121,8 +124,8 @@ def test_sync_raster_area_stats_error_wrong_content_type(self): | |
|
||
def test_sync_raster_area_stats_error_wrong_request_missing_json(self): | ||
rv = self.server.post( | ||
f"{URL_PREFIX}/locations/nc_spm_08/mapsets/PERMANENT/raster_layers" | ||
"/towns/area_stats_sync", | ||
f"{URL_PREFIX}/locations/{LOCATION}/mapsets/{MAPSET}/raster_layers" | ||
f"/{RASTER}/area_stats_sync", | ||
headers=self.admin_auth_header, | ||
data=None, | ||
content_type="application/json", | ||
|
Oops, something went wrong.