[PyWPS-dev] Question about process inputs

Suzana Barreto suzana.barreto at envsys.co.uk
Tue Nov 6 08:08:16 PST 2018


Hi All,

I have found the bug which is in basic.py class LiteralInput, when it
initialises BasicIO, it sets the min_occurs, max_occurs to 1 instead of
using the passed in parameter.
Do I need to fix this in the code base, following the given procedures of
course?

Thanks,
Suzana


On Tue, 6 Nov 2018 at 15:09, Suzana Barreto <suzana.barreto at envsys.co.uk>
wrote:

> Hi All,
>
> I am in the process of testing a process I created using PyWPS 4.  I have
> found an odd issue with the LiteralInputs for my process.  So for example,
> my process takes an input parameter (stats) where I have a max_occurs=9
> which should allow for any number of strings detailing the statistics I
> would like calculated for a given input file. When I issue a request with a
> number of values ('sum', 'median', 'std') for that particular parameter, my
> response contains the result for only 1 of the statistics for that
> parameter.  I traced the issue to service.py (create_literal_inputs), line
> 216 where a deque is created using the LiteralInput's max_occurs parameter
> to limit the size.  Unfortunately, it appears that this attribute is always
> 1.  When I do a describeProcess request, I notice that the max_occurs is
> also equal to 1 and this happens regardless of whatever value I change the
> max_occurs to on that or any other LiteralInputs for my process.  So my
> question is, has anyone come across this issue?  Am I doing something
> wrong?  Below is the code showing how I have defined the inputs.
>
> class BasicZonalStats(Process):
>     def __init__(self):
>         inputs = [ComplexInput('aoi_ndvi','Raster ndvi',
>                                supported_formats=[Format('image/tiff'), Format('application/x-ogc-wcs')],
>                                min_occurs=1, max_occurs=1, mode=MODE.NONE),
>                   LiteralInput('band','the band to calculate stats for', data_type='integer', min_occurs=1, max_occurs=1,
>                                mode=MODE.SIMPLE),
>                   LiteralInput('stats', 'Statistics to calculate', data_type='string', min_occurs=0, max_occurs=9,
>                                allowed_values=('sum', 'std', 'median', 'majority', 'minority', 'unique', 'range',
>                                                'nodata', 'nan'), mode=MODE.SIMPLE),
>                   LiteralInput('nodata','Nodata value', data_type='integer',mode=MODE.SIMPLE),
>                   ComplexInput('zones', 'Vector polygons to calculate stats on.',
>                                supported_formats=[Format('application/json')],
>                                min_occurs=1, max_occurs=1, mode=MODE.NONE)
>
>                   ]
>         outputs = [ComplexOutput('zonal_stats', 'Attribute Table',
>                                  supported_formats=[Format('application/json')],
>                                  )]
>
>         super(BasicZonalStats, self).__init__(
>             self._handler,
>             identifier='zonal',
>             version='0.1',
>             title="Basic Zonal Statistics using Rasterstats",
>             abstract="This is a naive and basic WPS, it assumes that both vector and raster inputs are in the same"
>                      "projection and as such does not do any error checking.  This will be fixed at a later stage so f"
>                      "or now please ensure that the inputs are in the same projection.",
>             profile='',
>             inputs=inputs,
>             outputs=outputs,
>             store_supported=True,
>             status_supported=True
>         )
>
> Any help with this would be much appreciated.
> Thanks,
> Suzana
> --
>
>
>
> *Dr Suzana BarretoSoftware AnalystEnvironment Systems*
> Tel: +44 (0) 1970 626688
> www.envsys.co.uk
>
> The information contained in this e-mail is intended only for the use of
> the person(s) to whom it is addressed and may contain confidential or
> privileged information. If you have received this e-mail in error please
> contact the sender and delete the material without copying, distributing or
> disclosing the content. All reasonable precautions have been taken to
> ensure that this e-mail is free from any virus, however, the recipient
> should verify this to be the case. Please 'think before you print'
>


-- 



*Dr Suzana BarretoSoftware AnalystEnvironment Systems*
Tel: +44 (0) 1970 626688
www.envsys.co.uk

The information contained in this e-mail is intended only for the use of
the person(s) to whom it is addressed and may contain confidential or
privileged information. If you have received this e-mail in error please
contact the sender and delete the material without copying, distributing or
disclosing the content. All reasonable precautions have been taken to
ensure that this e-mail is free from any virus, however, the recipient
should verify this to be the case. Please 'think before you print'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pywps-dev/attachments/20181106/13992cb0/attachment-0001.html>


More information about the pywps-dev mailing list