Commit f7d65327 authored by Javier Vegas-Regidor's avatar Javier Vegas-Regidor
Browse files

Fix case with cmorfiles not inside original_files

parent cc1b2ab0
......@@ -192,6 +192,11 @@ class DataFile(Publisher):
remote_diags_file = remote_diags_file.replace("/original_files/", "/")
return remote_diags_file
@property
def remote_cmor_file(self):
remote_cmor_file = self.remote_file.replace("/original_files/", "/")
return remote_cmor_file
@property
def local_status(self):
"""Get local storage status"""
......@@ -442,14 +447,18 @@ class DataFile(Publisher):
cube.coord("region")
except iris.exceptions.CoordinateNotFoundError:
return
try:
old_cube = iris.load_cube(self.remote_diags_file)
except Exception:
old_cube = None
for path in (self.remote_diags_file, self.remote_file,
self.remote_cmor_file):
try:
old_cube = iris.load_cube(self.remote_file)
old_cube = iris.load_cube(path)
except Exception:
# Bad data, overwrite
return
pass
else:
break
if old_cube is None:
return
new_data = {}
for region_slice in cube.slices_over("region"):
Log.debug(region_slice.coord("region").points[0])
......@@ -674,6 +683,7 @@ class NetCDFFile(DataFile):
for path in (
self.remote_diags_file,
self.remote_file,
self.remote_cmor_file,
):
if os.path.isfile(path):
try:
......@@ -721,6 +731,7 @@ class NetCDFFile(DataFile):
def check_is_in_storage(self, update_status=True):
for path in (
self.remote_file,
self.remote_cmor_file,
self.remote_diags_file
):
if os.path.isfile(path):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment