Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_greeter():
def greeter(request, response):
name = request.inputs['name'][0].data
assert type(name) is text_type
response.outputs['message'].data = "Hello %s!" % name
return response
return Process(handler=greeter,
identifier='greeter',
title='Greeter',
inputs=[LiteralInput('name', 'Input name', data_type='string')],
outputs=[LiteralOutput('message', 'Output message', data_type='string')])
" For example: -80,50,20,70",
min_occurs=1,
max_occurs=1,
default='14.6,14.8,8.7,8.9',
),
LiteralInput('start', 'Start Date',
data_type='date',
abstract='First day of the period to be searched for EO data.'
'(if not set, 30 days befor end of period will be selected',
default=(dt.now() - timedelta(days=30)).strftime('%Y-%m-%d'),
min_occurs=0,
max_occurs=1,
),
LiteralInput('end', 'End Date',
data_type='date',
abstract='Last day of the period to be searched for EO data.'
'(if not set, current day is set.)',
default=dt.now().strftime('%Y-%m-%d'),
min_occurs=0,
max_occurs=1,
),
LiteralInput('token', 'Authentification',
data_type='string',
abstract='Authentification token generated by Planet Earth Observation Explorer.',
# default='2013-12-31',
min_occurs=1,
max_occurs=1,
),
'(if not set, 30 days befor end of period will be selected',
default=(dt.now() - timedelta(days=30)).strftime('%Y-%m-%d'),
min_occurs=0,
max_occurs=1,
),
LiteralInput('end', 'End Date',
data_type='date',
abstract='Last day of the period to be searched for EO data.'
'(if not set, current day is set.)',
default=dt.now().strftime('%Y-%m-%d'),
min_occurs=0,
max_occurs=1,
),
LiteralInput('token', 'Authentification',
data_type='string',
abstract='Authentification token generated by Planet Earth Observation Explorer.',
# default='2013-12-31',
min_occurs=1,
max_occurs=1,
),
LiteralInput("archive_format", "Archive format",
abstract="Result files will be compressed into archives.\
Choose an appropriate format",
default="tar",
data_type='string',
min_occurs=1,
max_occurs=1,
allowed_values=['zip', 'tar']
)
LiteralInput("title", "Title",
abstract="Title to be written over the graphic",
default=None,
data_type='string',
min_occurs=0,
max_occurs=1,
),
LiteralInput('delta', 'Delta',
abstract='To set an offset for the values.'
'e.g. -273.15 to transform Kelvin to Celsius',
data_type='float',
default=0,
),
LiteralInput('ymin', 'ymin',
abstract='Minimum limit of colorbar.',
data_type='float',
default=None,
min_occurs=0,
max_occurs=1,),
LiteralInput('ymax', 'ymax',
abstract='Maximum limit of colorbar.',
data_type='float',
default=None,
min_occurs=0,
max_occurs=1,),
LiteralInput('figsize', 'Figure Size', data_type='string',
abstract='Give two numbers (as a string:"7,10") to define the size of the graphic',
def __init__(self):
inputs = [
LiteralInput('region', 'Region',
data_type='string',
# abstract= countries_longname(), # need to handle special non-ascii char in countries.
abstract="Country code, see ISO-3166-3:\
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements",
min_occurs=1,
max_occurs=len(countries()),
default='DEU',
allowed_values=countries()), # REGION_EUROPE #COUNTRIES
LiteralInput('mosaic', 'Union of multiple regions',
data_type='boolean',
abstract="If True, selected regions will be merged"
" into a single geometry.",
min_occurs=0,
max_occurs=1,
default=False),
ComplexInput('resource', 'Resource',
abstract='NetCDF Files or archive (tar/zip) containing NetCDF files.',
metadata=[Metadata('Info')],
min_occurs=1,
max_occurs=1000,
supported_formats=[
Format('application/x-netcdf'),
Format('application/x-tar'),
Format('application/zip'),
max_occurs=1000,
supported_formats=[
Format('application/x-netcdf'),
Format('application/x-tar'),
Format('application/zip'),
]),
LiteralInput("variable", "Variable",
abstract="Variable to be expected in the input files (variable will be detected if not set)",
default=None,
data_type='string',
min_occurs=0,
max_occurs=1,
),
LiteralInput('dateStart', 'Start date for time period',
abstract="Beginning of period (YYYY-MM-DD). "
"If not set, the first timestep will be condiderd as start.",
data_type='dateTime',
min_occurs=0,
max_occurs=1,
default=None,
),
LiteralInput('dateEnd', 'End date for time period',
abstract="End of period (YYYY-MM-DD)."
"If not set, the last timestep will be condiderd as end.",
data_type='dateTime',
min_occurs=0,
max_occurs=1,
default=None,
),
# Format('application/x-tar'),
# Format('application/zip'),
# ]),
ComplexInput('pr', 'Total daily precipitation',
abstract='NetCDF Files or archive (tar/zip) containing netCDF files storing total daily precipitation.',
metadata=[Metadata('Info')],
min_occurs=1,
max_occurs=1000,
supported_formats=[
Format('application/x-netcdf'),
Format('application/x-tar'),
Format('application/zip'),
]),
LiteralInput("grouping", "Grouping",
abstract="Temporal group over which the index is computed.",
default='yr',
data_type='string',
min_occurs=0,
max_occurs=1, # len(GROUPING),
allowed_values=GROUPING
)]
############################
# Function-specific inputs #
############################
extra_inputs = []
###########
# Outputs #
###########
LiteralInput('ymin', 'ymin',
abstract='Minimum limit of colorbar.',
data_type='float',
default=None,
min_occurs=0,
max_occurs=1,),
LiteralInput('ymax', 'ymax',
abstract='Maximum limit of colorbar.',
data_type='float',
default=None,
min_occurs=0,
max_occurs=1,),
LiteralInput('figsize', 'Figure Size', data_type='string',
abstract='Give two numbers (as a string:"7,10") to define the size of the graphic',
default='10,10',
),
]
outputs = [
# ComplexOutput('output_log', 'Logging information',
# abstract="Collected logs during process run.",
# as_reference=True,
# supported_formats=[Format('text/plain')]
# ),
#
# ComplexOutput("plotout_spaghetti", "Visualisation, Spaghetti plot",
# abstract="Visualisation of single variables as a spaghetti plot",
# supported_formats=[Format("image/png")],
" For example: -80,50,20,70",
min_occurs=1,
max_occurs=1,
default='14,15,8,9',
),
LiteralInput('start', 'Start Date',
data_type='date',
abstract='Start of the period to be searched for EO data. '
'Defaults to 30 days before the current date.',
default=(dt.now() - timedelta(days=30)).strftime('%Y-%m-%d'),
min_occurs=0,
max_occurs=1,
),
LiteralInput('end', 'End Date',
data_type='date',
abstract='End of the period to be searched for EO data. '
'Defaults to the current date.',
default=dt.now().strftime('%Y-%m-%d'),
min_occurs=0,
max_occurs=1,
),
LiteralInput('cloud_cover', 'Cloud Cover',
data_type='integer',
abstract='Maximum threshold on the cloud cover percentage. '
'Images whose cloud cover exceeds the threshold are ignored.',
default="30",
allowed_values=[0, 10, 20, 30, 40, 50, 60, 70, 80, 100]
),
data_type='string',
min_occurs=0,
max_occurs=1),
LiteralInput('featureids',
'Feature Ids',
abstract='fid(s) of the feature in the layer.',
data_type='string',
min_occurs=0,
max_occurs=1000),
LiteralInput('geoserver',
'Geoserver',
abstract=('Typically of the form '
'http://host:port/geoserver/wfs'),
data_type='string',
min_occurs=0),
LiteralInput('mosaic',
'Union of Feature Ids',
abstract=('If True, selected regions will be '
'merged into a single geometry.'),
data_type='boolean',
min_occurs=0,
default=False),
LiteralInput('initial_datetime',
'Initial datetime',
abstract='Initial datetime for temporal subsetting.',
data_type='dateTime',
min_occurs=0,
max_occurs=1),
LiteralInput('final_datetime',
'Final datetime',
abstract='Final datetime for temporal subsetting.',
data_type='dateTime',