Skip to content

Commit 455ee18

Browse files
committed
optional import terra
1 parent 6e9a3d0 commit 455ee18

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/bald/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
import rdflib
1212
import requests
1313
import six
14-
import terra.datetime
14+
15+
try:
16+
import terra.datetime
17+
terra_imp = True
18+
except ImportError:
19+
terra_imp = False
1520

1621
import bald.validation as bv
1722

@@ -759,7 +764,7 @@ def load_netcdf(afilepath, baseuri=None, alias_dict=None, cache=None):
759764
sattrs['bald__last_value'] = fhandle.variables[name][-1]
760765

761766
# datetime special case
762-
if 'units' in fhandle.variables[name].ncattrs():
767+
if 'units' in fhandle.variables[name].ncattrs() and terra_imp:
763768
ustr = fhandle.variables[name].getncattr('units')
764769
pattern = '^([a-z]+) since ([0-9T:\\. -]+)'
765770

0 commit comments

Comments
 (0)