Skip to content

Commit

Permalink
added metadata check for perperiod analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Mar 22, 2024
1 parent 004c630 commit 57f558c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hatyan/analysis_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ def analysis(ts, const_list, hatyan_settings=None, **kwargs): # nodalfactors=Tru
metadata['fu_alltimes'] = hatyan_settings.fu_alltimes
metadata['source'] = hatyan_settings.source
COMP_mean_pd = metadata_add_to_obj(COMP_mean_pd, metadata)
COMP_all_pd = metadata_add_to_obj(COMP_all_pd, metadata)

if hatyan_settings.return_allperiods:
COMP_all_pd = metadata_add_to_obj(COMP_all_pd, metadata)
return COMP_mean_pd, COMP_all_pd

return COMP_mean_pd
Expand Down
10 changes: 10 additions & 0 deletions tests/test_hatyan.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ def test_analysis_settings():
assert (np.abs(ts_comp_nfac1_fualltimes0_xfac1_peryear0['A'].values-comp_A_expected) < 10E-9).all()


@pytest.mark.unittest
def test_analysis_settings_perperiod():
file_data_comp0 = os.path.join(dir_testdata,'VLISSGN_obs1.txt')
ts_measurements_group0 = hatyan.readts_dia(filename=file_data_comp0)

comp_mean, comp_all = hatyan.analysis(ts=ts_measurements_group0, const_list='month', nodalfactors=True, fu_alltimes=False, xfac=True, analysis_perperiod="M", return_allperiods=True)
assert len(comp_mean.attrs) > 0
assert len(comp_all.attrs) > 0


@pytest.mark.unittest
def test_analysis_foreman():
current_station = 'VLISSGN'
Expand Down

0 comments on commit 57f558c

Please sign in to comment.