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
22from 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()
31args = docopt(__doc__, version=
'0.1')
32easting = args[
'<easting>']
33northing = args[
'<northing>']
35letter = args[
'<letter>']
36latitude, longitude = utm.to_latlon(float(easting), float(northing), int(zone), letter)
37print(
"#lat long",latitude,longitude)
42for 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']
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
gettimestamp(year, month, day)