Skip to content

Commit

Permalink
Fix issue 693
Browse files Browse the repository at this point in the history
  • Loading branch information
jlmaurer committed Jan 21, 2025
1 parent ad9b04b commit cdb510d
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tools/RAiDER/getStationDelays.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,25 @@ def get_station_data(inFile, dateList, gps_repo=None, numCPUs=8, outDir=None, re
del statsFile

# Add lat/lon/height info
origstatsFile = pd.read_csv(inFile)
statsFile = pd.read_csv(name)
statsFile = pd.merge(
left=statsFile, right=origstatsFile[['ID', 'Lat', 'Lon', 'Hgt_m']], how='left', left_on='ID', right_on='ID'
origstats = pd.read_csv(inFile)
keys = origstats.columns
lat_keys = ['lat', 'latitude', 'Lat', 'Latitude']
lon_keys = ['lon', 'longitude', 'Lon', 'Longitude']
lat_key = [ik for ik in lat_keys if ik in keys][0]
lon_key = [ik for ik in lon_keys if ik in keys][0]
origstats.rename(columns={lat_key: 'Lat', lon_key: 'Lon'}, inplace=True)

stats = pd.read_csv(name)
stats = pd.merge(
left=stats, right=origstats[['ID', 'Lat', 'Lon', 'Hgt_m']], how='left', left_on='ID', right_on='ID'
)
# drop all lines with nans and sort by station ID and year
statsFile.dropna(how='any', inplace=True)
stats.dropna(how='any', inplace=True)
# drop all duplicate lines
statsFile.drop_duplicates(inplace=True)
statsFile.sort_values(['ID', 'Date'])
statsFile.to_csv(name, index=False)
del origstatsFile, statsFile
stats.drop_duplicates(inplace=True)
stats.sort_values(['ID', 'Date'])
stats.to_csv(name, index=False)
del origstats, stats


def get_date(stationFile: Union[str, Path]) -> tuple[dt.datetime, int, int]:
Expand Down

0 comments on commit cdb510d

Please sign in to comment.