Skip to content

Commit

Permalink
trying to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteVandecrux committed Jul 1, 2024
1 parent 46004ea commit ce12d64
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/pypromice/process/L2toL3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd
import numpy as np
import xarray as xr
import toml
import toml, os
from sklearn.linear_model import LinearRegression

import logging
Expand Down Expand Up @@ -128,11 +128,15 @@ def gpsCoordinatePostprocessing(ds, var, config_folder='../aws-l0/metadata/stati
# fetching the station relocation dates at which the coordinates will/should
# have a break
config_file = config_folder +"/" + ds.attrs['station_id'] + ".toml"
with open(config_file, "r") as f:
config_data = toml.load(f)

# Extract station relocations from the TOML data
station_relocations = config_data.get("station_relocation", [])
if os.path.isfile(config_file):
with open(config_file, "r") as f:
config_data = toml.load(f)

# Extract station relocations from the TOML data
station_relocations = config_data.get("station_relocation", [])
else:
station_relocations = []
logger.warning('Did not find config file for '+ds.attrs['station_id']+'. Assuming no station relocation.')

# Convert the ISO8601 strings to pandas datetime objects
breaks = [pd.to_datetime(date_str) for date_str in station_relocations]
Expand Down

0 comments on commit ce12d64

Please sign in to comment.