Skip to content

Commit

Permalink
fixed testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Mar 22, 2024
1 parent f869e86 commit c1b6581
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion tests/examples/analysis_xfac.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@
#prediction and validation
#ts_prediction = hatyan.prediction(comp=COMP_merged, fu_alltimes=True, times_ext=times_ext_pred, timestep_min=times_step_pred)
ts_prediction_xfac0_xfac0 = hatyan.prediction(comp=COMP_merged_xfac0, fu_alltimes=fu_alltimes, xfac=False, times=times_pred)
ts_prediction_xfac1_xfac1 = hatyan.prediction(comp=COMP_merged_xfac1, fu_alltimes=fu_alltimes, xfac=True, times=times_pred)
# deliberately set xfac to wrong settings to allow predictions to succeed
COMP_merged_xfac0.xfac = True
COMP_merged_xfac1.xfac = False
ts_prediction_xfac0_xfac1 = hatyan.prediction(comp=COMP_merged_xfac0, fu_alltimes=fu_alltimes, xfac=True, times=times_pred)
ts_prediction_xfac1_xfac0 = hatyan.prediction(comp=COMP_merged_xfac1, fu_alltimes=fu_alltimes, xfac=False, times=times_pred)
ts_prediction_xfac1_xfac1 = hatyan.prediction(comp=COMP_merged_xfac1, fu_alltimes=fu_alltimes, xfac=True, times=times_pred)

#ts_prediction1min = hatyan.prediction(comp=COMP_merged, nodalfactors=nodalfactors, xfac=xfac, fu_alltimes=False, times_ext=times_ext_pred, timestep_min=1)
#ts_validation = hatyan.readts_dia(filename=file_data_predvali, station=current_station)
Expand Down
12 changes: 8 additions & 4 deletions tests/examples/numbering_extremes.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,22 @@
COMP_merged = hatyan.read_components(filename=file_data_comp0)

#prediction and validation
ts_prediction = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=xfac, fu_alltimes=True, times=times_pred)
ts_prediction = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=xfac, fu_alltimes=False, times=times_pred)

#ts_validation = hatyan.readts_dia(filename=file_data_predvali, station=current_station)
#ts_ext_validation = hatyan.readts_dia(filename=file_data_predvaliHWLW, station=current_station)
#hatyan.write_tsdia(ts=ts_prediction, filename='prediction_%im_%s.dia'%(times_step_pred,current_station))
ts_ext_prediction = hatyan.calc_HWLW(ts=ts_prediction)

if i_stat == 0:
if 'CADZD' in stats_xfac0:
xfac_cadzd=False
else:
xfac_cadzd=True
COMP_merged_CADZD = hatyan.read_components(filename=file_data_comp0.replace(current_station,'CADZD'))
COMP_merged_CADZD_M2 = COMP_merged_CADZD.loc[['A0','M2']]
ts_prediction_CADZD = hatyan.prediction(comp=COMP_merged_CADZD, nodalfactors=True, xfac=xfac, fu_alltimes=True, times=times_pred)
ts_prediction_CADZD_M2 = hatyan.prediction(comp=COMP_merged_CADZD_M2, nodalfactors=True, xfac=xfac, fu_alltimes=True, times=times_pred)
ts_prediction_CADZD = hatyan.prediction(comp=COMP_merged_CADZD, nodalfactors=True, xfac=xfac_cadzd, fu_alltimes=False, times=times_pred)
ts_prediction_CADZD_M2 = hatyan.prediction(comp=COMP_merged_CADZD_M2, nodalfactors=True, xfac=xfac_cadzd, fu_alltimes=False, times=times_pred)
ax1.plot(ts_prediction_CADZD_M2.index, ts_prediction_CADZD_M2['values'], label='CADZD_M2', color='k')
ts_ext_prediction_CADZD = hatyan.calc_HWLW(ts=ts_prediction_CADZD, debug=True)
bool_newyear = (ts_ext_prediction_CADZD.index>dt.datetime(yr,1,1)) & (ts_ext_prediction_CADZD['HWLWcode']==1)
Expand Down Expand Up @@ -162,7 +166,7 @@
#calculate tidal wave number
times_pred_HWLWno = slice(dt.datetime(yr_HWLWno-1,12,31),dt.datetime(yr_HWLWno,1,2,12), 1)
#COMP_merged_temp.loc['M2','A']=0.05
ts_prediction_HWLWno = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=xfac, fu_alltimes=True, times=times_pred_HWLWno)
ts_prediction_HWLWno = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=xfac, fu_alltimes=False, times=times_pred_HWLWno)
ts_ext_prediction_HWLWno_pre = hatyan.calc_HWLW(ts=ts_prediction_HWLWno)
#fig,(ax1,ax2) = hatyan.plot_timeseries(ts=ts_prediction_HWLWno, ts_ext=ts_ext_prediction_HWLWno_pre)
#breakit
Expand Down
2 changes: 1 addition & 1 deletion tests/examples/predictie_2019_19Ycomp4Ydia_VLISSGN.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import hatyan
hatyan.close('all')

dir_testdata = 'C:\\DATA\\hatyan_github\\tests'
dir_testdata = 'C:\\DATA\\hatyan\\tests'

selected_stations = ['VLISSGN']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#prediction and validation
ts_prediction1 = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=True, fu_alltimes=False, times=times_pred13)
ts_prediction2 = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=True, fu_alltimes=False, times=times_pred24)
COMP_merged.fu_alltimes = True
ts_prediction3 = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=True, fu_alltimes=True, times=times_pred13)
ts_prediction4 = hatyan.prediction(comp=COMP_merged, nodalfactors=True, xfac=True, fu_alltimes=True, times=times_pred24)
ts_validation = hatyan.readts_dia(filename=file_data_predvali, station=current_station)
Expand Down

0 comments on commit c1b6581

Please sign in to comment.