Skip to content

Commit

Permalink
Merge pull request #51 from PolarGeospatialCenter/update-versioning
Browse files Browse the repository at this point in the history
Update Versioning Scheme
  • Loading branch information
clairecporter authored Jun 14, 2022
2 parents 56846c3 + 643db07 commit b6bebfa
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python

# Located in improc/ortho/lib/

"""
PGC image processing utils and classes
"""

from .version import __version__, VERSION


5 changes: 3 additions & 2 deletions lib/ortho_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from osgeo import gdal, gdalconst, ogr, osr

from lib import taskhandler, utils
from lib import VERSION

#### Create Loggers
logger = logging.getLogger("logger")
Expand Down Expand Up @@ -320,7 +321,7 @@ def buildParentArgumentParser():
'--pbs/--slurm will only accept 1 thread.'
.format(ARGDEF_THREADS, ARGDEF_CPUS_AVAIL),
default=ARGDEF_THREADS)
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(utils.package_version))
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(VERSION))

return parser, pos_arg_keys

Expand Down Expand Up @@ -1445,7 +1446,7 @@ def WriteOutputMetadata(args, info):

#### Determine custom MD
dMD = {}
dMD["VERSION"] = "imagery_utils v{}".format(utils.package_version)
dMD["VERSION"] = "imagery_utils v{}".format(VERSION)
tm = datetime.today()
dMD["PROCESS_DATE"] = tm.strftime("%d-%b-%Y %H:%M:%S")
if not args.skip_warp:
Expand Down
3 changes: 0 additions & 3 deletions lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
logger = logging.getLogger("logger")
logger.setLevel(logging.DEBUG)

package_version = '1.5.7'


@contextlib.contextmanager
def capture_stdout_stderr():
oldout, olderr = sys.stdout, sys.stderr
Expand Down
3 changes: 3 additions & 0 deletions lib/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

__version__ = (2, 0, 0)
VERSION = "{}.{}.{}".format(*__version__)
4 changes: 3 additions & 1 deletion pgc_mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from osgeo import ogr, osr

from lib import mosaic, taskhandler, utils
from lib import VERSION


### Create Logger
logger = logging.getLogger("logger")
Expand Down Expand Up @@ -92,7 +94,7 @@ def main():
help="PBS resources requested (mimicks qsub syntax). Use only on HPC systems.")
parser.add_argument("--log",
help="file to log progress (default is <output dir>\{}".format(default_logfile))
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(utils.package_version))
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(VERSION))


#### Parse Arguments
Expand Down
3 changes: 2 additions & 1 deletion pgc_mosaic_build_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from osgeo import gdal

from lib import mosaic, taskhandler, utils
from lib import VERSION

logger = logging.getLogger("logger")
logger.setLevel(logging.DEBUG)
Expand Down Expand Up @@ -49,7 +50,7 @@ def main():
help="scratch space (default is mosaic directory)")
parser.add_argument("--gtiff-compression", choices=mosaic.GTIFF_COMPRESSIONS, default="lzw",
help="GTiff compression type. Default=lzw ({})".format(','.join(mosaic.GTIFF_COMPRESSIONS)))
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(utils.package_version))
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(VERSION))


#### Parse Arguments
Expand Down
3 changes: 2 additions & 1 deletion pgc_mosaic_query_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from osgeo import ogr, osr

from lib import mosaic, ortho_functions, utils
from lib import VERSION

### Create Logger
logger = logging.getLogger("logger")
Expand Down Expand Up @@ -67,7 +68,7 @@ def main():
help="build shapefile of intersecting images (only invoked if --no_sort is not used)")
parser.add_argument("--require-pan", action='store_true', default=False,
help="limit search to imagery with both a multispectral and a panchromatic component")
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(utils.package_version))
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(VERSION))


#### Parse Arguments
Expand Down
3 changes: 2 additions & 1 deletion pgc_ndvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from osgeo import gdal

from lib import ortho_functions, taskhandler, utils
from lib import VERSION

#### Create Loggers
logger = logging.getLogger("logger")
Expand Down Expand Up @@ -47,7 +48,7 @@ def main():
parser.add_argument("-l", help="PBS resources requested (mimicks qsub syntax, PBS only)")
parser.add_argument("--dryrun", action="store_true", default=False,
help="print actions without executing")
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(utils.package_version))
parser.add_argument("--version", action='version', version="imagery_utils v{}".format(VERSION))


#### Parse Arguments
Expand Down
9 changes: 5 additions & 4 deletions tests/func_test_ortho.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def setUp(self):
self.dstdir = os.path.join(script_dir, 'testdata', 'output')

if platform.system() == 'Windows':
self.gimpdem = r'Y:\elevation\dem\GIMP\GIMPv2\gimpdem_v2_30m.tif'
self.rampdem = r'Y:\elevation\dem\RAMP\RAMPv2\RAMPv2_wgs84_200m.tif'
self.gimpdem = r'V:\pgc\data\elev\dem\gimp\GIMPv2\gimpdem_v2_30m.tif'
self.rampdem = r'V:\pgc\data\elev\dem\ramp\RAMPv2_wgs84_200m.tif'
else:
self.gimpdem = '/mnt/agic/storage00/agic/private/elevation/dem/GIMP/GIMPv2/gimpdem_v2_30m.tif'
self.rampdem = '/mnt/agic/storage00/agic/private/elevation/dem/RAMP/RAMPv2/RAMPv2_wgs84_200m.tif'
self.gimpdem = '/mnt/pgc/data/elev/dem/gimp/GIMPv2/gimpdem_v2_30m.tif'
self.rampdem = '/mnt/pgc/data/elev/dem/ramp/RAMPv2_wgs84_200m.tif'

# if os.path.isdir(self.dstdir):
# shutil.rmtree(self.dstdir)
Expand Down Expand Up @@ -63,6 +63,7 @@ def test_image_types(self):
for test_image, epsg in test_images:

srcfp = os.path.join(self.srcdir, test_image)
print(srcfp)
cmd = r"""python "{}" -r 10 -p {} "{}" "{}" """.format(self.scriptpath, epsg, srcfp, self.dstdir)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
se, so = p.communicate()
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_test_ortho_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
sys.path.append(root_dir)

from lib import ortho_functions, utils
from lib import VERSION

#logger = logging.getLogger("logger")
# lso = logging.StreamHandler()
Expand Down Expand Up @@ -203,7 +204,7 @@ def setUp(self):
'<EPSG_CODE>4326</EPSG_CODE>',
'<FORMAT>GTiff</FORMAT>',
'<STRETCH>rf</STRETCH>',
'<VERSION>imagery_utils v{}</VERSION>'.format(utils.package_version),
'<VERSION>imagery_utils v{}</VERSION>'.format(VERSION),
'<ORTHO_HEIGHT>2568.0</ORTHO_HEIGHT>',
'<RESAMPLEMETHOD>near</RESAMPLEMETHOD>'
]
Expand Down

0 comments on commit b6bebfa

Please sign in to comment.