2'''Create magnetic declination table from UTM coordinates in degrees
3Requires `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
14from docopt
import docopt
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()
33 dt = datetime.datetime.fromtimestamp(ts, datetime.UTC)
37args = docopt(__doc__, version=
'0.1')
38easting = args[
'<easting>']
39northing = args[
'<northing>']
41letter = args[
'<letter>']
42latitude, longitude = utm.to_latlon(float(easting), float(northing), int(zone), letter)
43print(
"#lat long",latitude,longitude)
49for year
in range(2000,2030,1):
50 for month
in range(1,13,1):
51 request_text =
'https://www.ngdc.noaa.gov/geomag-web/calculators/calculateDeclination?lat1='+str(latitude) + \
52 '&lon1='+str(longitude) + \
54 '&startYear='+str(year) + \
55 '&startMonth='+str(month) + \
56 '&startDay='+str(day) + \
57 '&resultFormat=json' + \
60 x = requests.get(request_text)
62 y = json.loads(x.text)
63 result = y[
'result'][0]
64 declination = result[
'declination']
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
gettimestamp(year, month, day)