3
3
from dweather_client .client import get_australia_station_history , get_station_history , get_gridcell_history , get_tropical_storms ,\
4
4
get_yield_history , get_irrigation_data , get_power_history , get_gas_history , get_alberta_power_history , GRIDDED_DATASETS , has_dataset_updated ,\
5
5
get_forecast_datasets , get_forecast , get_cme_station_history , get_european_station_history , get_hourly_station_history , get_drought_monitor_history , get_japan_station_history ,\
6
- get_afr_history , get_cwv_station_history , get_teleconnections_history , get_station_forecast_history , get_station_forecast_stations , get_eaufrance_history
6
+ get_afr_history , get_cwv_station_history , get_teleconnections_history , get_station_forecast_history , get_station_forecast_stations , get_eaufrance_history , get_sap_station_history
7
7
from dweather_client .aliases_and_units import snotel_to_ghcnd
8
8
import pandas as pd
9
9
from io import StringIO
@@ -362,7 +362,7 @@ def test_historical_storms():
362
362
363
363
def test_hist_storm_as_of ():
364
364
df_all_na = get_tropical_storms (
365
- 'historical' , 'NA' , as_of = datetime .date (2023 , 5 , 20 ), ipfs_timeout = IPFS_TIMEOUT ) # This will throw an exception if there's ever a break in the chain
365
+ 'historical' , 'NA' , as_of = datetime .date (2023 , 5 , 20 ), ipfs_timeout = IPFS_TIMEOUT ) # This will throw an exception if there's ever a break in the chain
366
366
367
367
368
368
def test_yields ():
@@ -398,6 +398,12 @@ def test_cwv():
398
398
assert data [sorted (data )[0 ]].unit == u .dimensionless_unscaled
399
399
400
400
401
+ def test_sap ():
402
+ data = get_sap_station_history (ipfs_timeout = IPFS_TIMEOUT )
403
+ assert len (data ) == (sorted (data )[- 1 ] - sorted (data )[0 ]).days + 1
404
+ assert data [sorted (data )[0 ]].unit == u .dimensionless_unscaled
405
+
406
+
401
407
def test_australia ():
402
408
data = get_australia_station_history (
403
409
"Adelaide Airport" , weather_variable = "TMAX" , ipfs_timeout = IPFS_TIMEOUT )
@@ -489,13 +495,17 @@ def test_has_dataset_updated_false():
489
495
490
496
491
497
def test_forecast_station_history ():
492
- history = get_station_forecast_history ("cme_futures-daily" , "D2" , datetime .date (2023 , 1 , 31 ))
498
+ history = get_station_forecast_history (
499
+ "cme_futures-daily" , "D2" , datetime .date (2023 , 1 , 31 ))
493
500
assert history [datetime .date (2023 , 2 , 28 )] == 369.0
494
501
502
+
495
503
def test_forecast_station_stations ():
496
- stations = get_station_forecast_stations ("cme_futures-daily" , datetime .date (2023 , 1 , 31 ))
504
+ stations = get_station_forecast_stations (
505
+ "cme_futures-daily" , datetime .date (2023 , 1 , 31 ))
497
506
assert stations ["features" ][0 ]["properties" ]["station name" ] == "D2"
498
507
508
+
499
509
def test_eaufrance_station ():
500
510
history = get_eaufrance_history ("V720001002" , "FLOWRATE" )
501
- assert history [datetime .date (2022 ,4 , 2 )].value == 749
511
+ assert history [datetime .date (2022 , 4 , 2 )].value == 749
0 commit comments