Fixed validation

parent 0121a6f5
......@@ -6,6 +6,7 @@ from copy import deepcopy
import h5py
import numpy as np
import pandas as pd
from fluegg.asiancarpeggs import BigheadCarpEggs, GrassCarpEggs, SilverCarpEggs
from fluegg.drift import ConstantDriftingParticle
......@@ -307,11 +308,12 @@ class SimulationParameters:
# Hecras Start Time
elif key == "hecras_start_time":
if (isinstance(value, np.datetime64)
or isinstance(value, pd.Timestamp)):
or isinstance(value, pd.Timestamp)
or isinstance(value, datetime.datetime)):
return
else:
raise ValueError(
'hecras_start_time must be type datetime.time')
'hecras_start_time must be type datetime.datetime, np.datetime64, or pd.Timestamp')
# Diffusivity
elif key == "diffusivity":
if (value == 'parabolic') or \
......@@ -357,6 +359,18 @@ class SimulationParameters:
return
else:
raise ValueError('varying_dd must be constant or varying.')
elif key == "density":
if (isinstance(value, float)) or \
(isinstance(value, int)):
return
else:
raise ValueError('density must be type float or int')
elif key == "diameter":
if (isinstance(value, float)) or \
(isinstance(value, int)):
return
else:
raise ValueError('diameter must be type float or int')
# Direction of simulation
elif key == "direction":
if (value == 'forward') or (value == 'reverse'):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment