From 20bb5c14f38e5903ae65f85a53782e26e737e466 Mon Sep 17 00:00:00 2001 From: shaunwbell Date: Mon, 9 Dec 2024 07:45:07 -0800 Subject: [PATCH] Update SOAP2ArchiveCSV.py Pandas 3.0 Future warning - keywords --- SOAP2ArchiveCSV.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SOAP2ArchiveCSV.py b/SOAP2ArchiveCSV.py index c78d925..12a81e2 100755 --- a/SOAP2ArchiveCSV.py +++ b/SOAP2ArchiveCSV.py @@ -86,7 +86,7 @@ bd_thinned['hhmm'] = bd_thinned.apply(lambda row: str(pd.to_datetime(row['bestDate']).hour).zfill(2)+str(pd.to_datetime(row['bestDate']).minute).zfill(2), axis=1) out_columns=['platformId','latitude','longitude','year','doy','hhmm','value'] + ['value.'+str(i) for i in range(1,32)] + ['locationClass'] - bd_thinned[out_columns].to_csv('0'+args.buoyid+'.y' + year,' ',header=False,index=False,na_rep=np.nan,mode='a') + bd_thinned[out_columns].to_csv('0'+args.buoyid+'.y' + year,sep=' ',header=False,index=False,na_rep=np.nan,mode='a') except: print("no 28882 data in this file") @@ -112,10 +112,10 @@ #make special case for 122531, the peggy backup locator buoy if k=='122531': out_columns=['platformId','latitude','longitude','year','doy','hhmm','value'] + ['locationClass'] - bd_thinned[out_columns].dropna().to_csv(k + '.y' + year,' ',header=False,index=False,na_rep=np.nan,mode='a') + bd_thinned[out_columns].dropna().to_csv(k + '.y' + year,sep=' ',header=False,index=False,na_rep=np.nan,mode='a') else: out_columns=['platformId','latitude','longitude','year','doy','hhmm','value'] + ['value.'+str(i) for i in range(1,7)] + ['locationClass'] - bd_thinned[out_columns].dropna(subset=['latitude','longitude']).to_csv(k + '.y' + year,' ',header=False,index=False,na_rep=np.nan,mode='a') + bd_thinned[out_columns].dropna(subset=['latitude','longitude']).to_csv(k + '.y' + year,sep=' ',header=False,index=False,na_rep=np.nan,mode='a') if args.beaconyearfiles: pb = df.groupby('platformType') @@ -136,5 +136,5 @@ bd_thinned['doy'] = bd_thinned.apply(lambda row: str(pd.to_datetime(row['locationDate']).dayofyear), axis=1) bd_thinned['hhmm'] = bd_thinned.apply(lambda row: str(pd.to_datetime(row['locationDate']).hour).zfill(2)+str(pd.to_datetime(row['locationDate']).minute).zfill(2), axis=1) out_columns=['platformId','latitude','longitude','year','doy','hhmm','value'] + ['locationClass'] - bd_thinned[out_columns].dropna().to_csv(k + '.y' + year,' ',header=False,index=False,na_rep=np.nan,mode='a') + bd_thinned[out_columns].dropna().to_csv(k + '.y' + year,sep=' ',header=False,index=False,na_rep=np.nan,mode='a')