-
Notifications
You must be signed in to change notification settings - Fork 5
/
wps_xsubset_polygon.py
63 lines (53 loc) · 1.74 KB
/
wps_xsubset_polygon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# noqa: D100
import logging
from pywps import FORMATS, ComplexInput, ComplexOutput
from . import wpsio
from .subset import common_subset_handler, finch_subset_shape
from .wps_base import FinchProcess
LOGGER = logging.getLogger("PYWPS")
class SubsetPolygonProcess(FinchProcess):
"""Subset a NetCDF file using a polygon contour."""
def __init__(self):
inputs = [
ComplexInput(
"resource",
"NetCDF resource",
abstract="NetCDF files, can be OPEnDAP urls.",
max_occurs=1000,
supported_formats=[FORMATS.NETCDF, FORMATS.DODS],
),
wpsio.shape,
wpsio.start_date,
wpsio.end_date,
wpsio.variable_any,
]
outputs = [
ComplexOutput(
"output",
"netCDF output",
as_reference=True,
supported_formats=[FORMATS.NETCDF],
),
wpsio.output_metalink,
]
super().__init__(
self._handler,
identifier="subset_polygon",
title="Subset with one or more polygons",
version="0.1",
abstract=(
"Return the data for which grid cells center are within the "
"polygon for each input dataset as well as "
"the time range selected."
),
inputs=inputs,
outputs=outputs,
status_supported=True,
store_supported=True,
)
self.status_percentage_steps = {
"start": 5,
"done": 99,
}
def _handler(self, request, response):
return common_subset_handler(self, request, response, finch_subset_shape)