Skip to content

Commit

Permalink
Merge pull request #34 from voto-ocean-knowledge/callum-patch-8
Browse files Browse the repository at this point in the history
fix for when voltage has nans
  • Loading branch information
callumrollo authored Feb 23, 2024
2 parents 451e147 + eca5128 commit 5bd60c7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pilot_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def battery_plots(combined_nav_file, out_dir):
fig.savefig(filename, format='png', transparent=True)

# Prediction plot
df = df.dropna()
df_3day = df[df.index > df.index.max() - datetime.timedelta(days=3)]
regr = linear_model.LinearRegression()
regr.fit(df_3day.index.values.reshape(-1, 1), df_3day['Voltage'].values.reshape(-1, 1))
Expand Down Expand Up @@ -89,3 +90,9 @@ def battery_plots(combined_nav_file, out_dir):
dline = f"{datetime.datetime.now()},{glider},{mission},{v_per_day},{recover},{end}\n"
with open("/data/plots/nrt/battery_prediction.csv", "a") as file:
file.write(dline)


if __name__ == '__main__':
from pathlib import Path
battery_plots(Path('/data/data_l0_pyglider/nrt/SEA44/M85/rawnc/Martorn-rawgli.parquet'), '.')

4 changes: 3 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ matplotlib
xarray
netcdf4
cmocean
boto3
gsw
cartopy
scipy
geopy
tqdm
polars
scikit-learn
pyarrow
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ matplotlib
xarray
netcdf4
cmocean
boto3
gsw
cartopy
scipy
geopy
tqdm
polars
scikit-learn
pyarrow

0 comments on commit 5bd60c7

Please sign in to comment.