While calculating mean and standard deviation of surface albedo data for few years (as it is unable to plot long time series), whenever I try to run the code, it gives me following error. Can anyone please help me in resolving it. (The code which I am using is mentioned at the bottom)
Error:
Traceback (most recent call last): File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 59, in handle_request result = cached(context.method, proc, context, context.args, context.kwargs) File "/opt/cdstoolbox/cdscompute/cdscompute/caching.py", line 108, in cached result = proc(context, *context.args, **context.kwargs) File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 124, in __call__ return p(*args, **kwargs) File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 60, in __call__ return self.proc(context, *args, **kwargs) File "/home/cds/cdsservices/services/retrieve.py", line 197, in execute remote = context.call_resource(name, request, update_specific_metadata={'app_scope': 'adaptor'}) File "/opt/cdstoolbox/cdscompute/cdscompute/context.py", line 307, in call_resource return c.call_resource(service, *args, **kwargs).value File "/opt/cdstoolbox/cdsworkflows/cdsworkflows/future.py", line 76, in value raise self._result cdsworkflows.error.ClientError: {'traceback': 'Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "/usr/lib64/python3.6/http/client.py", line 1346, in getresponse response.begin() File "/usr/lib64/python3.6/http/client.py", line 307, in begin version, status, reason = self._read_status() File "/usr/lib64/python3.6/http/client.py", line 268, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/lib64/python3.6/socket.py", line 586, in readinto return self._sock.recv_into(b) File "/usr/lib64/python3.6/ssl.py", line 971, in recv_into return self.read(nbytes, buffer) File "/usr/lib64/python3.6/ssl.py", line 833, in read return self._sslobj.read(len, buffer) File "/usr/lib64/python3.6/ssl.py", line 590, in read v = self._sslobj.read(len, buffer) ConnectionResetError: [Errno 104] Connection reset by peerDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 450, in send
timeout=timeout
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 788, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File “/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py”, line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File “/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py”, line 769, in reraise
raise value.with_traceback(tb)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 710, in urlopen
chunked=chunked,
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 449, in _make_request
six.raise_from(e, None)
File “<string>”, line 3, in raise_from
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 444, in _make_request
httplib_response = conn.getresponse()
File “/usr/lib64/python3.6/http/client.py”, line 1346, in getresponse
response.begin()
File “/usr/lib64/python3.6/http/client.py”, line 307, in begin
version, status, reason = self._read_status()
File “/usr/lib64/python3.6/http/client.py”, line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”)
File “/usr/lib64/python3.6/socket.py”, line 586, in readinto
return self._sock.recv_into(b)
File “/usr/lib64/python3.6/ssl.py”, line 971, in recv_into
return self.read(nbytes, buffer)
File “/usr/lib64/python3.6/ssl.py”, line 833, in read
return self._sslobj.read(len, buffer)
File “/usr/lib64/python3.6/ssl.py”, line 590, in read
v = self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/opt/cds/cdsinf/python/lib/cdsclient/brokerclient.py”, line 570, in make_request
**kwargs
File “/usr/local/lib/python3.6/site-packages/requests/api.py”, line 75, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/api.py”, line 61, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 529, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 645, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 501, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/opt/cds/cdsinf/python/lib/cdsinf/runner/dispatcher.py”, line 617, in handle_request
context.get(“method_config”, None))
File “/opt/cds/adaptor/cdshandlers/adaptorlib/adaptorrequesthandler.py”, line 68, in handle_request
return super().handle_request(cdsinf, data_request, self.config)
File “/opt/cds/cdsinf/python/lib/cdsinf/runner/requesthandler.py”, line 170, in handle_request
return handler(cdsinf, request, config)
File “/opt/cds/adaptor/cdshandlers/archivecombiner/handler.py”, line 63, in handle_retrieve
config)
File “/opt/cds/adaptor/cdshandlers/adaptorlib/url_fetch.py”, line 103, in combine
di)
File “/opt/cds/adaptor/cdshandlers/adaptorlib/url_fetch.py”, line 189, in process_one_input_archive
di, extractor_class)
File “/opt/cds/adaptor/cdshandlers/adaptorlib/url_fetch.py”, line 170, in dataitem_to_extractor
allocation = di.as_file(use_server_filename=self.use_server_filenames)
File “/opt/cds/cdsinf/python/lib/cdsinf/brokerclient.py”, line 209, in as_file
response_info = self._write_to(tmp_name, allocation.handle_out_of_space)
File “/opt/cds/cdsinf/python/lib/cdsclient/brokerclient.py”, line 346, in _write_to
return self._build_requester(filename, handle_out_of_space).make_request(None)
File “/opt/cds/cdsinf/python/lib/cdsclient/requesterchain.py”, line 311, in make_request
result = self.next_in_chain.make_request(request)
File “/opt/cds/cdsinf/python/lib/cdsclient/brokerclient.py”, line 589, in make_request
“http://copernicus-climate.eu/exc/data-connection”) from e
cdsclient.exceptions.DataProviderFailed: Failed to connect to data source: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))
'}
Code:
Import cdstoolbox as ct
layout = { 'input_ncols': 2,
'input_align': 'bottom'
}
variables = { 'Broadband directional surface albedo': 'albb_dh',
}
tip = 'Changing value will restart the processing.'
@ct.application(title='Calculate Mean and Stdev', layout=layout)
@ct.input.dropdown('variable', label='Variable', values=variables.keys(), help=tip)
@ct.input.dropdown('year', label='Year', values=range(2014, 2017), help=tip)
@ct.input.text('lon', type=float, label='Longitude', default=-121.5, help=tip)
@ct.input.text('lat', type=float, label='Latitude', default=69.4, help=tip)
@ct.output.livefigure()
def mean_standard_deviation(
variable,
year,
lon,
lat,
):
data = ct.catalogue.retrieve(
'satellite-albedo',
{
'variable': variables[variable],
'grid': ['3', '3'],
'product_type': 'satellite-albedo',
'satellite': 'Proba',
'sensor': 'VGT',
'product_version': 'v1',
'horizontal_resolution': '1km',
'year': [
'2014', '2015',
'2016'
],
'month': [
'01', '04',
'07', '10'
],
'nominal_day': [
'03'
],
}
)
data_location = ct.geo.extract_point(ct.cube.select(data, time=year), lon=lon, lat=lat)
monthly_mean = ct.climate.monthly_mean(data_location)
monthly_std = ct.climate.monthly_std(data_location)
daily_mean = ct.climate.daily_mean(data_location)
daily_std = ct.climate.daily_std(data_location)
fig = ct.chart.line(
daily_mean,
error_y=daily_std,
scatter_dict={'name': 'daily'},
layout_dict={'title': 'Monthly/Daily mean with standard deviation'}
)
fig = ct.chart.line(
monthly_mean,
fig=fig,
error_y=monthly_std,
scatter_dict={'name': 'Monthly'}
)
return fig