diff --git a/hermesv3_bu/io_server/io_netcdf.py b/hermesv3_bu/io_server/io_netcdf.py index 56f57e808b92d22002a50c044b32b25965f93c60..caa95582438d5be6dc00864f99cb049ebc67e747 100755 --- a/hermesv3_bu/io_server/io_netcdf.py +++ b/hermesv3_bu/io_server/io_netcdf.py @@ -49,7 +49,11 @@ class IoNetcdf(IoServer): lat_o = nc.variables['latitude'][:] lon_o = nc.variables['longitude'][:] except KeyError as e: - error_exit("{0} variable not found in {1} file.".format(str(e), netcdf_path)) + try: + lat_o = nc.variables['lat'][:] + lon_o = nc.variables['lon'][:] + except KeyError as e: + error_exit("{0} variable not found in {1} file.".format(str(e), netcdf_path)) if date_type == 'daily': try: @@ -125,7 +129,13 @@ class IoNetcdf(IoServer): n_lat = len(lat_o) time = nc.variables['time'] except KeyError as e: - error_exit("{0} variable not found in {1} file.".format(str(e), path)) + try: + lat_o = nc.variables['lat'][:] + lon_o = nc.variables['lon'][:] + n_lat = len(lat_o) + time = nc.variables['time'] + except KeyError as e: + error_exit("{0} variable not found in {1} file.".format(str(e), path)) # From time array to list of dates. time_array = num2date(time[:], time.units, CALENDAR_STANDARD) i_time = np.where(time_array == date_array[0])[0][0]