Skip to content

Commit

Permalink
Add auto cut feature. Add ability to zoom in on map and add dates
Browse files Browse the repository at this point in the history
  • Loading branch information
NOAA-Strausz committed Nov 6, 2020
1 parent 323e103 commit 989dc1a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drifter_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
help="add ice concentration as last field and output file")
parser.add_argument('-ph', '--phyllis', action="store_true",
help="output format for phyllis friendly processing")
parser.add_argument('-d', '--date', action="store_true",
help="add occasional date to track")
parser.add_argument('-e', '--erddap', nargs='+',
help="get directly from akutan erddap server, requires argos id followed desired years")
help="get directly from akutan erddap server, requires argos id followed by desired years")
parser.add_argument('-H', '--hour', action="store_true",
help="resample all data to even hour and interpolate")
parser.add_argument('-s', '--speed', action="store_true",
Expand All @@ -47,7 +45,7 @@
help="file has legacy format from ecofoci website, if file contains ice concentraion, add 'i'")
parser.add_argument('-c', '--cut', nargs='*',
type=lambda x: datetime.strptime(x, "%Y-%m-%dT%H:%M:%S"),
help="date span in format '2019-01-01T00:00:00 2019-01-01T00:00:01' for example")
help="date span in format '2019-01-01T00:00:00 2019-01-01T00:00:01' also works with only beginning date and if no date is given it will try using the drifter database")
parser.add_argument('-de', '--despike', action="store_true",
help="Do some simple despiking of sst")
args=parser.parse_args()
Expand Down Expand Up @@ -187,16 +185,17 @@ def trim_data(df, delta_t):
start = results[0].strftime('%Y-%m-%d %H:%M:%S')
drifter_db.close()
print("Drifter",argos_id,"start time is",start)
return df[start:]
#return df[start:]
return df.loc[start:]
except:
print("Database not available!")
elif len(delta_t) == 1:
start = delta_t[0].strftime('%Y-%m-%d %H:%M:%S')
return df[start:]
return df.loc[start:]
elif len(delta_t) == 2:
start = delta_t[0].strftime('%Y-%m-%d %H:%M:%S')
end = delta_t[1].strftime('%Y-%m-%d %H:%M:%S')
return df[start:end]
return df.loc[start:end]
else:
quit("Too many cut arguments!")

Expand Down

0 comments on commit 989dc1a

Please sign in to comment.