Skip to content

Commit

Permalink
Merge pull request #125 from GeoscienceAustralia/New_coord_classes
Browse files Browse the repository at this point in the history
New Coordinate Classes
  • Loading branch information
harry093 authored Feb 28, 2021
2 parents 05b1a1b + ef208be commit 82c059a
Show file tree
Hide file tree
Showing 6 changed files with 625 additions and 19 deletions.
6 changes: 3 additions & 3 deletions geodepy/angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def __init__(self, hp_angle=0.0):
if len(hp_dec_str) > 2:
if int(hp_dec_str[2]) > 5:
raise ValueError(
f'Invalid HP Notation: 3st decimal place greater '
f'Invalid HP Notation: 3rd decimal place greater '
f'than 5: {self.hp_angle}')

def __repr__(self):
Expand Down Expand Up @@ -1021,7 +1021,7 @@ def hp2dec(hp):
f'than 5: {hp}')
if len(hp_dec_str) > 2:
if int(hp_dec_str[2]) > 5:
raise ValueError(f'Invalid HP Notation: 3st decimal place greater '
raise ValueError(f'Invalid HP Notation: 3rd decimal place greater '
f'than 5: {hp}')
degmin, second = divmod(abs(hp) * 1000, 10)
degree, minute = divmod(degmin, 100)
Expand Down Expand Up @@ -1217,4 +1217,4 @@ def angular_typecheck(angle):
if type(angle) in supported_types:
return angle.dec()
else:
return angle
return float(angle)
14 changes: 11 additions & 3 deletions geodepy/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def __init__(self, semimaj, inversef):
# Projections
class Projection(object):
def __init__(self, falseeast, falsenorth, cmscale, zonewidth, initialcm):
"""
Transverse Mercator Projection Parameters
:param falseeast: Easting (m) assigned to Central Meridian
:param falsenorth: Northing (m) assigned to Equator
:param cmscale: Central Meridian Scale Factor (unitless, 1 is no scale)
:param zonewidth: Width (decimal degrees) of each TM Zone
:param initialcm: Longitude (decimal degrees) of TM Zone 1
"""
self.falseeast = falseeast
self.falsenorth = falsenorth
self.cmscale = cmscale
Expand Down Expand Up @@ -501,7 +509,7 @@ class parameters.
-0.2, 0.1, -1.8, 0.08, 0, 0, 0)

# ITRF2000 parameters
# ftp://itrf.ensg.ign.fr/pub/itrf/ITRF.TP
# ftp://ftp.iers.org/products/reference-systems/terrestrial/itrf/ITRF.TP
# NOTE: This ref lists translations in centimetres. All other ITRF
# transformations are shown in millimetres.
# NOTE: All translations and rates of translation shown below have been
Expand Down Expand Up @@ -531,15 +539,15 @@ class parameters.
0.0, -0.6, -1.4, 0.01, 0, 0, 0.02)

itrf00to90 = iers2trans('ITRF2000', 'ITRF90', date(1988, 1, 1),
14.7, 13.5, -13.9, 0.75, 0, 0, -0.18,
24.7, 23.5, -35.9, 2.45, 0, 0, -0.18,
0.0, -0.6, -1.4, 0.01, 0, 0, 0.02)

itrf00to89 = iers2trans('ITRF2000', 'ITRF89', date(1988, 1, 1),
29.7, 47.5, -73.9, 5.85, 0, 0, -0.18,
0.0, -0.6, -1.4, 0.01, 0, 0, 0.02)

itrf00to88 = iers2trans('ITRF2000', 'ITRF88', date(1988, 1, 1),
24.7, 11.5, -97.9, 8.95, 0, 0, -0.18,
24.7, 11.5, -97.9, 8.95, 0.10, 0, -0.18,
0.0, -0.6, -1.4, 0.01, 0, 0, 0.02)

# The locations of files used in the height module
Expand Down
13 changes: 10 additions & 3 deletions geodepy/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@
sqrt, cosh, sinh, tan, atan, log)
import datetime
from geodepy.constants import utm, grs80
from geodepy.angles import (DECAngle, DMSAngle, DDMAngle, HPAngle,
hp2dec, hp2dms, hp2ddm, dec2hp, dec2dms, dec2ddm,
dd2sec, dec2hp_v, hp2dec_v, angular_typecheck)
from geodepy.angles import (DECAngle, HPAngle, GONAngle, DMSAngle, DDMAngle,
dec2hp, dec2hpa, dec2gon, dec2gona,
dec2dms, dec2ddm,
hp2dec, hp2deca, hp2gon, hp2gona,
hp2dms, hp2ddm, hp2rad, hp2dec_v,
gon2dec, gon2deca, gon2hp, gon2hpa,
gon2dms, gon2ddm, gon2rad,
dd2sec, angular_typecheck)


# Universal Transverse Mercator Projection Parameters
# TODO: Add this part into functions: geo2grid, grid2geo, psfandgridconv
proj = utm


Expand Down
Loading

0 comments on commit 82c059a

Please sign in to comment.