GEUS-Glaciology-and-Climate/pypromice

Wrong reformatting of GPS data for pre-2009 data

Closed this issue · 0 comments

probably the cause of GEUS-Glaciology-and-Climate/PROMICE-AWS-data-issues#90

Prior to 2009, GPS was only saving the decimal minutes to the logger file.

Example here from NUK_L 2008 file

PrNo,PrNo,year,day,time,p,T1,T2,RH,WS,WD,Srin,Srout,Lrin,Lrout,Tcnr1,Haws,Hstk,abl,Tice1,Tice2,Tice3,Tice4,Tice5,Tice6,Tice7,Tice8,Ornt,Xtilt,Ytilt,lat,lon,elev,hdop,Tlog,V,yearhour
...
7,4962,2007,232,2130,931.42,6.814,6.438,66.17,3.135,111.5,325,91.2,-35.98,-25.04,9.67,2.447,0.802,16.84,-0.08,0.732,0.057,-0.346,0.058,0.088,0.236,-0.554,-5.899,-0.183,-2.207,**28.902,31.3,**,0.8,6.961,13,5565
7,4962,2007,232,2200,931.54,6.626,5.62,70.7,4.008,79.9,120.6,35.12,-31.37,-16.65,7.07,2.201,0.807,16.71,-0.037,0.436,0.254,-0.32,0.124,-0.133,0.374,-0.519,-6.681,-0.225,-2.228,**28.902,31.3**,,0.8,7.13,12.85,5566
7,4962,2007,232,2230,931.54,7.74,6.196,68.6,3.553,85.2,132.7,42.05,-53.92,-18.54,7.68,2.44,0.801,16.8,-0.319,0.456,0.072,-0.285,0.054,-0.009,0.022,-0.612,-6.357,-0.184,-2.228,**28.902,31.3**,,0.8,6.36,12.87,5566

See also a handheld gps measurement of NUK_L position in 2007 and 2008 from a maintenance report:
image

Knowing the expected degree of the latitude and degree of longitude (given in the config file), pypromice L0toL1 reformats to decimal degree coordinates:

if hasattr(ds, 'latitude') and hasattr(ds, 'longitude'):
ds['gps_lat'] = reformatGPS(ds['gps_lat'], ds.attrs['latitude'])
ds['gps_lon'] = reformatGPS(ds['gps_lon'], ds.attrs['longitude'])

def reformatGPS(pos_arr, attrs):
'''Correct position if only recorded minutes (and not degrees), and
reformat values and attributes
Parameters
----------
pos_arr : xr.Dataarray
GPS position array
attrs : dict
Array attributes
Returns
-------
pos_arr : xr.Dataarray
Formatted GPS position array
'''
if np.any((pos_arr <= 90) & (pos_arr > 0)):
pos_arr = pos_arr + 100*attrs
a = pos_arr.attrs
pos_arr = np.floor(pos_arr / 100) + (pos_arr / 100 - np.floor(pos_arr / 100)) * 100 / 60
pos_arr.attrs = a
return pos_arr

In this function and in this case, it should read more like:

# true_coord= floor(coord_from_config_file)  + dec_minutes_from_logger_file / 60
pos_arr = np.floor(attrs)  + pos_arr/60

@PennyHow I don't have the overview of the reformatting needed from at AWS. It looks like it's interpreting some coordinates as mm.ss (minutes.second).