Skip to content

Commit 6abc0b9

Browse files
committed
Remove class structure as not adding anything, just making more difficult to use.
1 parent 375bff2 commit 6abc0b9

7 files changed

+497
-494
lines changed

bin/pysl4landgeditools.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@
4949

5050
args = parser.parse_args()
5151

52-
geditools = pysl4land.pysl4land_gedi.GEDITools()
5352
valid_only = not args.all
54-
geditools.gedi02_b_beams_gpkg(args.input, args.output, valid_only, args.epsg)
53+
pysl4land.pysl4land_gedi.gedi02_b_beams_gpkg(args.input, args.output, valid_only, args.epsg)
54+

bin/pysl4landicesat2tools.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151

5252
args = parser.parse_args()
5353

54-
icesat2tools = pysl4land.pysl4land_icesat2.ICESAT2Tools()
55-
icesat2tools.icesat2_alt08_beams_gpkg(args.input, args.output, args.polys, args.epsg)
54+
pysl4land.pysl4land_icesat2.icesat2_alt08_beams_gpkg(args.input, args.output, args.polys, args.epsg)
55+

pysl4land/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
import json
4141

4242
PYSL4LAND_VERSION_MAJOR = 0
43-
PYSL4LAND_VERSION_MINOR = 0
44-
PYSL4LAND_VERSION_PATCH = 1
43+
PYSL4LAND_VERSION_MINOR = 1
44+
PYSL4LAND_VERSION_PATCH = 0
4545

4646
PYSL4LAND_VERSION = str(PYSL4LAND_VERSION_MAJOR) + "." + str(PYSL4LAND_VERSION_MINOR) + "." + str(PYSL4LAND_VERSION_PATCH)
4747
PYSL4LAND_VERSION_OBJ = LooseVersion(PYSL4LAND_VERSION)
@@ -78,3 +78,4 @@
7878
logging.config.dictConfig(config)
7979
else:
8080
logging.basicConfig(level=log_default_level, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
81+

pysl4land/pysl4land_gedi.py

+167-164
Large diffs are not rendered by default.

pysl4land/pysl4land_icesat2.py

+293-293
Large diffs are not rendered by default.

pysl4land/pysl4land_utils.py

+29-30
Original file line numberDiff line numberDiff line change
@@ -36,42 +36,41 @@
3636

3737
logger = logging.getLogger(__name__)
3838

39-
class PySL4LandUtils(object):
39+
def latlon_to_utm_zone_number(latitude, longitude):
40+
"""
41+
Find the UTM zone number for a give latitude and longitude. UTM zone will be returned for all the
42+
lat/longs within the input arrays, which must be of the same length. Function will also work with
43+
a single value, at which point a single int will be returned.
4044
41-
def latlon_to_utm_zone_number(self, latitude, longitude):
42-
"""
43-
Find the UTM zone number for a give latitude and longitude. UTM zone will be returned for all the
44-
lat/longs within the input arrays, which must be of the same length. Function will also work with
45-
a single value, at which point a single int will be returned.
45+
:param latitude: numpy array of floats
46+
:param longitude: numpy array of floats
4647
47-
:param latitude: numpy array of floats
48-
:param longitude: numpy array of floats
48+
:return: int or array of ints.
4949
50-
:return: int or array of ints.
50+
"""
51+
import numpy
52+
utm_zones = (((longitude + 180) / 6) + 1)
53+
utm_zones = numpy.rint(utm_zones).astype(int)
5154

52-
"""
53-
import numpy
54-
utm_zones = (((longitude + 180) / 6) + 1)
55-
utm_zones = numpy.rint(utm_zones).astype(int)
55+
utm_zones[(56 <= latitude) & (latitude < 64) & (3 <= longitude) & (longitude < 12)] = 32
56+
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 9)] = 31
57+
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 21)] = 33
58+
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 33)] = 35
59+
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 42)] = 37
5660

57-
utm_zones[(56 <= latitude) & (latitude < 64) & (3 <= longitude) & (longitude < 12)] = 32
58-
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 9)] = 31
59-
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 21)] = 33
60-
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 33)] = 35
61-
utm_zones[(72 <= latitude) & (latitude <= 84) & (longitude >= 0) & (longitude < 42)] = 37
61+
return utm_zones
6262

63-
return utm_zones
63+
def latlon_to_mode_utm_zone_number(latitude, longitude):
64+
"""
65+
Find the mode UTM zone for a list of lat/lon values.
6466
65-
def latlon_to_mode_utm_zone_number(self, latitude, longitude):
66-
"""
67-
Find the mode UTM zone for a list of lat/lon values.
67+
:param latitude: numpy array of floats
68+
:param longitude: numpy array of floats
69+
:return: int (mode UTM zone)
6870
69-
:param latitude: numpy array of floats
70-
:param longitude: numpy array of floats
71-
:return: int (mode UTM zone)
71+
"""
72+
import scipy.stats
73+
utm_zones = latlon_to_utm_zone_number(latitude, longitude)
74+
mode, count = scipy.stats.mode(utm_zones)
75+
return mode[0]
7276

73-
"""
74-
import scipy.stats
75-
utm_zones = self.latlon_to_utm_zone_number(latitude, longitude)
76-
mode, count = scipy.stats.mode(utm_zones)
77-
return mode[0]

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import os
3838

3939
setuptools.setup(name='pysl4land',
40-
version='0.0.1',
40+
version='0.1.0',
4141
description='Python tools to process spaceborne lidar (GEDI and ICESAT2) for land (pySL4Land) applications.',
4242
author='Pete Bunting',
4343
author_email='[email protected]',

0 commit comments

Comments
 (0)