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

Fix latest version and cdo interpolation

parent 36b0df68
......@@ -896,6 +896,9 @@ class Cmor3Convention(DataConvention):
if not os.path.isdir(base_path):
base_path = base_path.replace(
'/original_files/cmorfiles/', '/cmorfiles/')
if not os.path.isdir(base_path):
base_path = base_path.replace(
'/cmorfiles/', '/diags/')
versions = os.listdir(base_path)
versions.sort(reverse=True)
self.config.cmor.version = versions[0]
......
# coding=utf-8
"""CDO-based interpolation"""
import os
from cdo import CDOException
import numpy as np
......@@ -399,11 +400,25 @@ class InterpolateCDO(Diagnostic):
handler.close()
temp = TempFile.get()
Utils.cdo().remap(
",".join((self.grid.split("_")[0], self.weights)),
input=variable_file,
output=temp,
)
try:
Utils.cdo().remap(
",".join((self.grid.split("_")[0], self.weights)),
input=variable_file,
output=temp,
)
except CDOException as ex:
msg = (
'(cdf_put_vara_double): NetCDF: Numeric '
'conversion not representable'
)
if msg not in ex.msg:
raise
Utils.cdo().remap(
",".join((self.grid.split("_")[0], self.weights)),
input=variable_file,
output=temp,
options='-b F64'
)
handler = Utils.open_cdf(temp)
if units:
......
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