Skip to content

Commit

Permalink
Fix bug in run lmr data (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed Jun 7, 2021
1 parent 8d213dc commit a99c4df
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion oggm/core/massbalance.py
Expand Up @@ -2,6 +2,7 @@
# Built ins
import logging
# External libs
import cftime
import numpy as np
import pandas as pd
import netCDF4
Expand Down Expand Up @@ -394,7 +395,11 @@ def __init__(self, gdir, mu_star=None, bias=None,
with ncDataset(fpath, mode='r') as nc:
# time
time = nc.variables['time']
time = netCDF4.num2date(time[:], time.units)
try:
time = netCDF4.num2date(time[:], time.units)
except ValueError:
# This is for longer time series
time = cftime.num2date(time[:], time.units, calendar='noleap')
ny, r = divmod(len(time), 12)
if r != 0:
raise ValueError('Climate data should be N full years')
Expand Down

0 comments on commit a99c4df

Please sign in to comment.