Skip to content

Commit

Permalink
gdal must be >=2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yumorishita committed Nov 24, 2020
1 parent ee9a54c commit 8d66aac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LiCSBAS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- python>=3.6
- astropy
- beautifulsoup4
- gdal
- gdal>=2.4
- h5py
- matplotlib
- numpy
Expand Down
2 changes: 1 addition & 1 deletion LiCSBAS_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
python>=3.6
astropy
beautifulsoup4
gdal
gdal>=2.4
h5py
matplotlib
numpy
Expand Down
43 changes: 33 additions & 10 deletions bin/LiCSBAS_check_install.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
#!/usr/bin/env python3
"""
v1.0 20201009 Yu Morishita, GSI
v1.1 20201124 Yu Morishita, GSI
This script checks if LiCSBAS install is OK or not.
"""
#%% Change log
'''
v1.0 20190729 Yu Morishita, Uni of Leeds and GSI
v1.1 20201124 Yu Morishita, GSI
- gdal must be >=2.4
v1.0 20201009 Yu Morishita, GSI
- Original implementation
'''


#%% Import
from importlib import import_module
import platform
import shutil
import sys


#%% Main
if __name__ == "__main__":
flag = True
modules = ['astropy',
'bs4',
'gdal',
'h5py',
'matplotlib',
'numpy',
'requests',
'statsmodels',
]


print('\nPython version: {}'.format(platform.python_version()))
pyver = platform.python_version_tuple()
Expand All @@ -37,22 +42,37 @@
else:
print(' OK')

print('\nCheck required modues')

print('\nCheck required modues and versions')
for module in modules:
try:
imported = import_module(module)

except Exception as err:
print(' ERROR: {}'.format(err))
flag = False
else:
if module == 'gdal':
ver = imported.VersionInfo()
else:
ver = imported.__version__

ver = imported.__version__
print(' {}({}) OK'.format(module, ver))


try:
imported = import_module('gdal', 'osgeo')
except Exception as err:
print(' ERROR: {}'.format(err))
flag = False
else:
_ver = imported.VersionInfo()
ver1 = int(_ver[0])
ver2 = int(_ver[1:3])
ver3 = int(_ver[3:5])
ver = '{}.{}.{}'.format(ver1, ver2, ver3)
if ver1 <= 2 and ver2 <= 3:
print(' ERROR: gdal ver is {} but must be >= 2.4'.format(ver))
flag = False
else:
print(' gdal({}) OK'.format(ver))


print('\nCheck LiCSBAS commands')
rc = shutil.which('LiCSBAS01_get_geotiff.py')
if rc is None:
Expand All @@ -71,8 +91,11 @@
else:
print(' OK')


if flag:
print('\nLiCSBAS install is OK\n')
sys.exit(0)
else:
print('\nERROR: LiCSBAS install is NOT OK\n')
sys.exit(1)

0 comments on commit 8d66aac

Please sign in to comment.