2 '''Create magnetic declination table from UTM coordinates in degrees
3 Requires `pip install docopt numpy utm`
6 makedeclinationtable.py <easting> <northing> <zone> <letter>
9 easting UTM Easting of the site
10 northing UTM Northing of the site
14 from docopt
import docopt
22 from datetime
import datetime, date, timezone
25 d = date(year, month, day)
26 ts = calendar.timegm(d.timetuple())
27 dt = datetime.utcfromtimestamp(ts)
28 fts = dt.replace(tzinfo=timezone.utc).timestamp()
31 args = docopt(__doc__, version=
'0.1')
32 easting = args[
'<easting>']
33 northing = args[
'<northing>']
35 letter = args[
'<letter>']
36 latitude, longitude = utm.to_latlon(float(easting), float(northing), int(zone), letter)
37 print(
"#lat long",latitude,longitude)
42 for year
in range(2000,2025,1):
43 for month
in range(1,13,1):
44 x = requests.get(
'https://www.ngdc.noaa.gov/geomag-web/calculators/calculateDeclination?lat1='+str(latitude) + \
45 '&lon1='+str(longitude) + \
47 '&startYear='+str(year) + \
48 '&startMonth='+str(month) + \
49 '&startDay='+str(day) + \
51 y = json.loads(x.text)
52 result = y[
'result'][0]
53 declination = result[
'declination']
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
def gettimestamp(year, month, day)