Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #18 from cp4cds/subset-eur-44
Browse files Browse the repository at this point in the history
subset EUR-44
  • Loading branch information
cehbrecht committed Oct 30, 2018
2 parents 898ca3f + f820b23 commit b2422ea
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 7 deletions.
6 changes: 3 additions & 3 deletions c4cds/processes/wps_cordex_subsetter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def __init__(self):
LiteralInput('country', 'Country',
abstract='Choose a Country like UK.',
data_type='string',
allowed_values=['Egypt', 'UK', 'France', 'Germany'],
default='Egypt'),
allowed_values=['UK', 'France', 'Germany', 'Egypt'],
default='UK'),
LiteralInput('model', 'Model',
abstract='Choose a model like MOHC-HadRM3P.',
data_type='string',
Expand All @@ -44,7 +44,7 @@ def __init__(self):
abstract='Choose a variable like tas.',
data_type='string',
allowed_values=['tas', 'tasmax', 'tasmin'],
default='tasmin'),
default='tas'),
LiteralInput('year', 'Match year', data_type='integer',
abstract='File should match this year.',
allowed_values=[1990, 2000, 2010],
Expand Down
4 changes: 4 additions & 0 deletions c4cds/subsetter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

COUNTRY_BBOX = {
# bbox: min_lon, max_lon, min_lat, max_lat
# values taken from: https://data.humdata.org/dataset/bounding-boxes-for-countries
'Egypt': '13,37,5,50.861',
'UK': '-13.683,3.858,48.5,64.067',
'France': '-5.225,9.55,41.333,51.2',
'Germany': '5.867,15.033,45.967,55.133',
}


Expand Down
Binary file modified docs/source/_static/media/cordex_subsetter_thumbnail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion tests/resources/data/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

We are using the following file:

http://esgf-data1.ceda.ac.uk/thredds/fileServer/esg_cordex/cordex/output/AFR-44i/MOHC/ECMWF-ERAINT/evaluation/r1i1p1/MOHC-HadRM3P/v1/mon/tasmin/v20131211/tasmin_AFR-44i_ECMWF-ERAINT_evaluation_r1i1p1_MOHC-HadRM3P_v1_mon_199001-199012.nc
* http://esgf-data1.ceda.ac.uk/thredds/fileServer/esg_cordex/cordex/output/AFR-44i/MOHC/ECMWF-ERAINT/evaluation/r1i1p1/MOHC-HadRM3P/v1/mon/tasmin/v20131211/tasmin_AFR-44i_ECMWF-ERAINT_evaluation_r1i1p1_MOHC-HadRM3P_v1_mon_199001-199012.nc
* http://esgf-data1.ceda.ac.uk/thredds/fileServer/esg_cordex/cordex/output/EUR-44i/MOHC/ECMWF-ERAINT/evaluation/r1i1p1/MOHC-HadRM3P/v1/mon/tas/v20131212/tas_EUR-44i_ECMWF-ERAINT_evaluation_r1i1p1_MOHC-HadRM3P_v1_mon_199001-199012.nc

## C3S_CMIP5

Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_subsetter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.mark.skipif(not resource_ok(CORDEX_NC),
reason="Test data not available.")
def test_subset_by_country():
def test_subset_by_country_egypt():
subsetter = Subsetter()
assert 'tasmin_AFR-44i_Egypt_ECMWF-ERAINT_evaluation_r1i1p1_MOHC-HadRM3P_v1_mon_199001-199012.nc' in \
subsetter.subset_by_country(CORDEX_NC, country='Egypt')
14 changes: 12 additions & 2 deletions tests/test_wps_cordex_subsetter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@
cfgfiles = [resource_file('test.cfg'), ]


def test_wps_cordex_subsetter():
def test_wps_cordex_subsetter_egypt():
client = client_for(Service(processes=[CordexSubsetter()], cfgfiles=cfgfiles))
datainputs = "domain=Egypt"
datainputs = "country=Egypt,variable=tasmin"
resp = client.get(
service='WPS', request='Execute', version='1.0.0', identifier='cordex_subsetter',
datainputs=datainputs)
print(resp.data)
assert_response_success(resp)


def test_wps_cordex_subsetter_uk():
client = client_for(Service(processes=[CordexSubsetter()], cfgfiles=cfgfiles))
datainputs = "country=UK"
resp = client.get(
service='WPS', request='Execute', version='1.0.0', identifier='cordex_subsetter',
datainputs=datainputs)
Expand Down

0 comments on commit b2422ea

Please sign in to comment.