Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
with nc.Dataset(url) as D:
response.outputs['conventions'].data = D.Conventions
response.outputs['outdods'].url = url
response.outputs['ncraw'].file = os.path.join(DATA_DIR, 'netcdf', 'time.nc')
response.outputs['ncraw'].data_format = FORMATS.NETCDF
return response
return Process(handler=complex_proces,
identifier='my_opendap_process',
title='Opendap process',
inputs=[
ComplexInput(
'dods',
'Opendap input',
supported_formats=[Format('DODS'), Format('NETCDF')],
# mode=MODE.STRICT
)
],
outputs=[
LiteralOutput(
'conventions',
'NetCDF convention',
),
ComplexOutput('outdods', 'Opendap output',
supported_formats=[FORMATS.DODS, ],
as_reference=True),
ComplexOutput('ncraw', 'NetCDF raw data output',
supported_formats=[FORMATS.NETCDF, ],
as_reference=False)
])
if grass.mapcalc("$output = $input + $value", output="output", input="input", value=1.0) != 0:
raise NoApplicableCode("Could not set GRASS region.")
# Export the result
out = "./output.tif"
if grass.run_command("r.out.gdal", input="output", type="Float32", output=out) != 0:
raise NoApplicableCode("Could not export result from GRASS.")
response.outputs['output'] = out
return response
return Process(handler=sum_one,
identifier='sum_one',
title='Process Sum One',
inputs=[ComplexInput('input', [Format('image/img')])],
outputs=[ComplexOutput('output', [Format('image/tiff')])])
netCDF spatial increment",
supported_formats=[Format('image/png')],
as_reference=True,
),
ComplexOutput("output_indices", "Climate indices for growth conditions over all timesteps",
abstract="Archive (tar/zip) containing calculated climate indices",
supported_formats=[Format('application/x-tar'),
Format('application/zip')
],
as_reference=True,
),
ComplexOutput("output_reference", "Climate indices for growth conditions of reference period",
abstract="Archive (tar/zip) containing calculated climate indices",
supported_formats=[Format('application/x-tar'),
Format('application/zip')
],
as_reference=True,
),
ComplexOutput("output_prediction", "predicted growth conditions",
abstract="Archive containing files of the predicted\
growth conditions",
supported_formats=[Format('application/x-tar'),
Format('application/zip')
],
as_reference=True,
),
ComplexOutput("output_info", "GAM statistics information",
abstract="Graphics and information of the learning statistics",
def __init__(self):
inputs = [
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'),
]),
LiteralInput("region", "Region",
# abstract= countries_longname(), # need to handle special non-ascii char in countries.
data_type='string',
min_occurs=0,
max_occurs=len(countries()),
allowed_values=countries()), # REGION_EUROPE #COUNTRIES
]
###########
# OUTPUTS
###########
outputs = [
ComplexOutput('output_nc', "Subsets",
abstract="Tar archive containing the netCDF files",
LiteralInput("culture_type", "Culture type",
abstract="Select culture type",
default='fallow',
data_type='string',
min_occurs=1,
max_occurs=8,
allowed_values=["fallow", "intensive", "extensive"] # sem
),
]
outputs = [
ComplexOutput("out_tasmean", "Yearly mean temperature",
abstract="Tar archive containing the netCDF EUR tas mean files",
supported_formats=[Format('application/x-tar'),
Format('application/x-netcdf')],
as_reference=True,
),
ComplexOutput("out_segetalflora", "Segetalflora",
abstract="Tar archive containing the segetalflora data",
supported_formats=[Format('application/x-tar'),
Format('application/x-netcdf')],
as_reference=True,
),
ComplexOutput('output_log', 'Logging information',
abstract="Collected logs during process run.",
as_reference=True,
supported_formats=[Format('text/plain')]
),
]
ComplexOutput('sim_netcdf', 'Sim Seasonal cycle',
abstract="Sim seasonal cycle netCDF",
as_reference=True,
supported_formats=[Format('application/x-netcdf')]
),
ComplexOutput("output", "Analogues Viewer html page",
abstract="Interactive visualization of calculated analogues",
supported_formats=[Format("text/html")],
as_reference=True,
),
ComplexOutput('output_log', 'Logging information',
abstract="Collected logs during process run.",
as_reference=True,
supported_formats=[Format('text/plain')]
),
]
super(AnalogsmodelProcess, self).__init__(
self._handler,
identifier="analogs_model",
title="Analogues of circulation (based on climate model data)",
abstract='Search for days with analogue pressure pattern for models data sets',
version="0.10",
metadata=[
Metadata('LSCE', 'http://www.lsce.ipsl.fr/en/index.php'),
Metadata('Doc', 'http://flyingpigeon.readthedocs.io/en/latest/'),
],
inputs=inputs,
outputs=outputs,
status_supported=True,
def __init__(self):
inputs = [
ComplexInput('resource', 'Resource',
abstract='NetCDF Files (with one variable) 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'),
]),
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('delta', 'Delta',
abstract='To set an offset for the values.'
'e.g. -273.15 to transform Kelvin to Celsius',
data_type='float',
default=0,
), ]
outputs = [
ComplexOutput("output_pca", "R - datafile",
abstract="Principal components (PCA)",
supported_formats=[Format('text/plain')],
as_reference=True,
),
ComplexOutput("output_classification", "R - workspace",
abstract="Weather regime classification",
supported_formats=[Format("application/octet-stream")],
as_reference=True,
),
ComplexOutput("output_frequency", "Frequency",
abstract="Weather regime frequency values per year",
supported_formats=[Format('text/plain')],
as_reference=True,
),
ComplexOutput('output_netcdf', 'Subsets for one dataset',
abstract="Prepared netCDF file as input for weatherregime calculation",
as_reference=True,
supported_formats=[Format('application/x-netcdf')]
),
ComplexOutput('output_log', 'Logging information',
abstract="Collected logs during process run.",
as_reference=True,
supported_formats=[Format('text/plain')]
),
]
def __init__(self):
inputs = [
ComplexInput('resource', 'Resource',
abstract='NetCDF Files (with one variable) or archive (tar/zip) containing NetCDF files.'
'if multiple files are provided, a mean over all will be displayed',
metadata=[Metadata('Info')],
min_occurs=1,
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("title", "Title",
abstract="Title to be written over the graphic",
default=None,
data_type='string',
def __init__(self):
inputs = [
LiteralInput('region', 'Region',
data_type='string',
abstract="Continent name.",
min_occurs=1,
max_occurs=len(_CONTINENTS_),
default='Africa',
allowed_values=_CONTINENTS_), # REGION_EUROPE #COUNTRIES
ComplexInput('resource', 'Resource',
abstract='NetCDF Files or archive (tar/zip) containing netCDF files.',
min_occurs=1,
max_occurs=1000,
supported_formats=[
Format('application/x-netcdf'),
Format('application/x-tar'),
Format('application/zip'),
]),
]
outputs = [output, metalink]
super(SubsetcontinentProcess, self).__init__(
self._handler,
identifier="subset_continents",
title="Subset Continents",
version="0.11",
abstract="Return the data whose grid cells intersect the selected continents for each input dataset.",
metadata=[
Metadata('Doc',
'https://flyingpigeon.readthedocs.io/en/latest/processes_des.html#subset-processes'),