Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
makedeclinationtable Namespace Reference

Functions

 gettimestamp (year, month, day)
 

Variables

 args = docopt(__doc__, version='0.1')
 
 easting = args['<easting>']
 
 northing = args['<northing>']
 
 zone = args['<zone>']
 
 letter = args['<letter>']
 
 latitude
 
 longitude
 
str model = 'IGRF'
 
int day = 1
 
str key = 'zNEw7'
 
str request_text
 
 x = requests.get(request_text)
 
 y = json.loads(x.text)
 
 result = y['result'][0]
 
 declination = result['declination']
 

Detailed Description

Create magnetic declination table from UTM coordinates in degrees
Requires `pip install docopt numpy utm`

Usage:
    makedeclinationtable.py <easting> <northing> <zone> <letter>

Arguments:
    easting   UTM Easting of the site
    northing  UTM Northing of the site
    zone      UTM zone
    letter    UTM letter

Function Documentation

◆ gettimestamp()

makedeclinationtable.gettimestamp ( year,
month,
day )

Definition at line 26 of file makedeclinationtable.py.

26def gettimestamp(year, month, day):
27 d = datetime.date(year, month, day)
28 ts = calendar.timegm(d.timetuple())
29 if sys.version_info < (3,12,0):
30 dt = datetime.datetime.utcfromtimestamp(ts)
31 fts = dt.replace(tzinfo=datetime.timezone.utc).timestamp()
32 else:
33 dt = datetime.datetime.fromtimestamp(ts, datetime.UTC)
34 fts = dt.timestamp()
35 return int(fts)
36

Variable Documentation

◆ args

makedeclinationtable.args = docopt(__doc__, version='0.1')

Definition at line 37 of file makedeclinationtable.py.

◆ easting

makedeclinationtable.easting = args['<easting>']

Definition at line 38 of file makedeclinationtable.py.

◆ northing

makedeclinationtable.northing = args['<northing>']

Definition at line 39 of file makedeclinationtable.py.

◆ zone

makedeclinationtable.zone = args['<zone>']

Definition at line 40 of file makedeclinationtable.py.

◆ letter

makedeclinationtable.letter = args['<letter>']

Definition at line 41 of file makedeclinationtable.py.

◆ latitude

makedeclinationtable.latitude

Definition at line 42 of file makedeclinationtable.py.

◆ longitude

makedeclinationtable.longitude

Definition at line 42 of file makedeclinationtable.py.

◆ model

str makedeclinationtable.model = 'IGRF'

Definition at line 45 of file makedeclinationtable.py.

◆ day

int makedeclinationtable.day = 1

Definition at line 46 of file makedeclinationtable.py.

◆ key

str makedeclinationtable.key = 'zNEw7'

Definition at line 47 of file makedeclinationtable.py.

◆ request_text

str makedeclinationtable.request_text
Initial value:
1= 'https://www.ngdc.noaa.gov/geomag-web/calculators/calculateDeclination?lat1='+str(latitude) + \
2 '&lon1='+str(longitude) + \
3 '&model='+model + \
4 '&startYear='+str(year) + \
5 '&startMonth='+str(month) + \
6 '&startDay='+str(day) + \
7 '&resultFormat=json' + \
8 '&key='+key

Definition at line 51 of file makedeclinationtable.py.

◆ x

makedeclinationtable.x = requests.get(request_text)

Definition at line 60 of file makedeclinationtable.py.

◆ y

makedeclinationtable.y = json.loads(x.text)

Definition at line 62 of file makedeclinationtable.py.

◆ result

makedeclinationtable.result = y['result'][0]

Definition at line 63 of file makedeclinationtable.py.

◆ declination

makedeclinationtable.declination = result['declination']

Definition at line 64 of file makedeclinationtable.py.