Skip to content

Commit

Permalink
Tweak weather merge for buoy data
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Aug 23, 2021
1 parent d84edbe commit 3990f9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='surfpy',
version='0.97.2',
version='0.97.3',
description='Wave and weather tools written in pure python',
url='https://github.com/mpiannucci/surfpy',
author='Matthew Iannucci',
Expand Down
13 changes: 9 additions & 4 deletions surfpy/buoydata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from math import isnan
from typing import List
from . import units
from .swell import Swell
Expand Down Expand Up @@ -133,11 +134,15 @@ def merge_wave_weather_data(wave_data: List[BuoyData], weather_data: List[BuoyDa
continue

weather.change_units(units.Units.metric)
wave.air_temperature = weather.air_temperature
if weather.air_temperature is not None and not isnan(weather.air_temperature):
wave.air_temperature = weather.air_temperature
wave.short_forecast = weather.short_forecast
wave.wind_speed = weather.wind_speed
wave.wind_direction = weather.wind_direction
wave.wind_compass_direction = weather.wind_compass_direction
if weather.wind_speed is not None and not isnan(weather.wind_speed):
wave.wind_speed = weather.wind_speed
if weather.wind_direction is not None and not isnan(weather.wind_direction):
wave.wind_direction = weather.wind_direction
if weather.wind_compass_direction is not None:
wave.wind_compass_direction = weather.wind_compass_direction
last_weather_index = i
break

Expand Down

0 comments on commit 3990f9f

Please sign in to comment.