Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New boolean in analysis_compare to run report maker only #102

Merged
merged 15 commits into from
Aug 14, 2023

Conversation

ledm
Copy link
Collaborator

@ledm ledm commented Aug 7, 2023

Sometimes, we need to just make a report instead of running the analysis_timeseries code as well. It's possible to change this in the input_yml file, but this runtime bool overwrites that function.

Basically, this means that we can produce a report without changing the yml, which is handy while running several things at once.

At the same time, I've added several regions that Colin requested and included the new historical recipe.

Closes #103
Closes #104
Closes #105

@ledm ledm requested a review from valeriupredoi August 7, 2023 13:53
@ledm
Copy link
Collaborator Author

ledm commented Aug 7, 2023

Hey @valeriupredoi, no rush on this, but I wound up doing two things at once. Figured a merge could do both.

@ledm
Copy link
Collaborator Author

ledm commented Aug 7, 2023

Wait a second, just found out that the parser isn't done properly. I'm going to implement it as as BooleanOptionalAction instead.

parser.add_argument('--feature', default=True, action=argparse.BooleanOptionalAction)

@valeriupredoi
Copy link
Owner

@ledm take your time! If you wish, you can always mark the PR as Draft while you still devving it 🍺

@ledm
Copy link
Collaborator Author

ledm commented Aug 7, 2023

Okay, pretty sure it's behaving the way I want it to now. Ready for review.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@ledm ledm mentioned this pull request Aug 9, 2023
Copy link
Collaborator Author

@ledm ledm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix commits

key_files/alkalinity.yml Outdated Show resolved Hide resolved
key_files/atmospco2.yml Outdated Show resolved Hide resolved
key_files/chlorophyll.yml Outdated Show resolved Hide resolved
key_files/dic.yml Outdated Show resolved Hide resolved
key_files/dust.yml Outdated Show resolved Hide resolved
key_files/nitrate.yml Outdated Show resolved Hide resolved
key_files/oxygen.yml Outdated Show resolved Hide resolved
key_files/salinity.yml Outdated Show resolved Hide resolved
key_files/silicate.yml Outdated Show resolved Hide resolved
key_files/temperature.yml Outdated Show resolved Hide resolved
@ledm ledm requested a review from DrYool August 9, 2023 14:41
@ledm ledm mentioned this pull request Aug 9, 2023
2 tasks
@valeriupredoi
Copy link
Owner

this RfR bud? 🍺

@ledm
Copy link
Collaborator Author

ledm commented Aug 10, 2023

Yeah, go for it!

I wouldn't merge until @DrYool gives it a go though, as he raised the issues it solves.

Copy link
Owner

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, let me add an API test and - like you say - wait for @DrYool to give you green light 🟢

bgcval2/analysis_compare.py Outdated Show resolved Hide resolved
Copy link
Owner

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ledm one hitch - the assert 0 is causing the local tests (with a fresh env) to fail - could you pls remove it, or place a valid exception that needs be raised? 🍺

bgcval2/bgcval2_make_report.py Show resolved Hide resolved
@valeriupredoi
Copy link
Owner

valeriupredoi commented Aug 10, 2023

wait - am a bit confused is --skip-timeseries accepting a value in the command eg --skip-timesries True or --skip-timeseries False? or is it a bool ie when --skip-timesries in command line that means skip analysis_timeseries, and when not present at all skip_timeseries is None

@valeriupredoi
Copy link
Owner

also, happy to see Starting analysis_timeseries is not happening with --skip_timesries but there is still some model data loading in the test, with output:

analysis-Timeseries.py: Beginning to call timeseriesAnalysis for  Temperature_integration_test
timeseriesAnalysis:      init.
timeseriesAnalysis:     loadModel.
Does not exist /home/valeriu/bgcval2/local_test/BGC_data/valeriu/bgcval2/shelves/timeseries/u-cp647debug/u-cp647debug_Temperature_integration_test.shelve
timeseriesAnalysis:     loadModel       Opening shelve: /home/valeriu/bgcval2/local_test/BGC_data/valeriu/bgcval2/shelves/timeseries/u-cp647debug/u-cp647debug_Temperature_integration_test.shelve
KeysView(<shelve.DbfilenameShelf object at 0x7f8342954b90>)
timeseriesAnalysis:     loadModel       Checking:  ['Global', 'Surface', 'mean']         has  1 keys
timeseriesAnalysis:     loadModel:      post checks...
timeseriesAnalysis:     loadModel       shelveFn: /home/valeriu/bgcval2/local_test/BGC_data/valeriu/bgcval2/shelves/timeseries/u-cp647debug/u-cp647debug_Temperature_integration_test.shelve
timeseriesAnalysis:     loadModel       readFiles: contains  1 files.   Up to  /home/valeriu/bgcval2/local_test/BGC_data/u-cp647debug/nemo_u-cp647debugo_1y_1990_grid-T.nc
timeseriesAnalysis:     loadModel.      no New Files requested. Loaded:  1 Model data

Is that supposed to be there?

valeriupredoi and others added 2 commits August 10, 2023 16:25
Co-authored-by: Valeriu Predoi <valeriu.predoi@gmail.com>
@ledm
Copy link
Collaborator Author

ledm commented Aug 10, 2023

wait - am a bit confused is --skip-timeseries accepting a value in the command eg --skip-timesries True or --skip-timeseries False? or is it a bool ie when --skip-timesries in command line that means skip analysis_timeseries, and when not present at all skip_timeseries is None

skip_timeseries sets a bool which means that you don't analyse any new data, but you do load the old ones. This means that is is exactly the behaviour we expect.

timeseriesAnalysis: loadModel. no New Files requested. Loaded: 1 Model data

The confusing part is that the overwrites a bool in the input_yml, which can be True or False. So, there's 3 options:

  • None (no command line flag): Do whatever is in the input_yml
  • True: Skip new data in timeseriesAnalysis.
  • False: Force it to look for an analyse it.

@valeriupredoi
Copy link
Owner

valeriupredoi commented Aug 10, 2023

OK so in terms of the actual command line flag:

  • None (no command line flag): Do whatever is in the input_yml -> ""
  • True: Skip new data in timeseriesAnalysis. -> "--skip_timeseries"
  • False: Force it to look for an analyse it. -> "--no-skip_timesries"

No other values given to the cmd line flags, no?

@ledm
Copy link
Collaborator Author

ledm commented Aug 10, 2023

OK so in terms of the actual command line flag:

  • None (no command line flag): Do whatever is in the input_yml -> ""
  • True: Skip new data in timeseriesAnalysis. -> "--skip_timeseries"
  • False: Force it to look for an analyse it. -> "--no-skip_timesries"

No other values given to the cmd line flags, no?

Yes, this is accurate.

@valeriupredoi
Copy link
Owner

skip_timeseries sets a bool which means that you don't analyse any new data, but you do load the old ones. This means that is is exactly the behaviour we expect.

Gotcha! Awesome, makes sense then 🍻

@valeriupredoi
Copy link
Owner

That's cool, we have tests to test these new options, but am still a bit weirded out why my local tests fail unless that assert 0 gets removed

Copy link
Owner

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests pass locally (on me home machine) with both Python=3.10 and 3.11 no problem (and of course on GA machine), awesome work @ledm (very possible me work machine, having an old OS, is messing up due to old kernel) 🍻

@ledm
Copy link
Collaborator Author

ledm commented Aug 14, 2023

Okay, we got the ok from @DrYool, go ahead and merge, @valeriupredoi!

@valeriupredoi
Copy link
Owner

Brilliant, many thanks @DrYool for testing (and closing all the other issues, it's always nice when users close their issues when things work well for them!) and @ledm for the nice enhancement 🍺 x2

@valeriupredoi valeriupredoi merged commit a775ec0 into main Aug 14, 2023
@valeriupredoi valeriupredoi deleted the dev_report_only branch August 14, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Diagnostic variable lumping Mixed layer depth issues Missing geographical regions
2 participants