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

regrid-xy scripting to use pathlib for filename parsing #32

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ceblanton
Copy link
Contributor

resolves #31

Chris Blanton added 3 commits September 26, 2024 18:05
- remove undesired fms-user remap cache "feature"
- remove some commented code
- add automatic exit code checking for the fregrid system calls
@ceblanton ceblanton marked this pull request as ready for review September 27, 2024 21:30
@ceblanton ceblanton requested a review from ilaflott September 27, 2024 21:31
@ceblanton
Copy link
Contributor Author

The original problem was Tim noticing these files in my /xtmp directory:

an200:~%>ls /xtmp/$USER  

job37278991work  job37467327work  job37656721work  job37657433work  job37657673work  job37803646work  job37804186work  job37819491work	job38426463work  job38946649work
job37278992work  job37467331work  job37656722work  job37657437work  job37657674work  job37803657work  job37804187work  job37819492work	job38426464work  job38946697work
job37278993work  job37467333work  job37656724work  job37657439work  job37657679work  job37803658work  job37804188work  job37819493work	job38426465work  job38946713work
job37278994work  job37467335work  job37656725work  job37657444work  job37657680work  job37803661work  job37804192work  job37819494work	job38426466work  job38946716work

Instead of just fixing the problem, I thought I'd "fix" other string filename parsing. But it took me a lot longer than it should have and I'm not sure it's greatly improved.

@ilaflott
Copy link
Member

ilaflott commented Oct 1, 2024

did you check the tests in app/regrid-xy/t ?

@ilaflott
Copy link
Member

ilaflott commented Oct 1, 2024

Let me applaud the turn-towards pathlib though

@ceblanton
Copy link
Contributor Author

You got me- I must have missed something.

With the main branch, 10 out of 12 pass, and with these changes, only 6 out of 12 pass.

@ceblanton
Copy link
Contributor Author

I take it back- I somehow was using an old branch. 10 / 12 still pass, with this update.

@ilaflott ilaflott mentioned this pull request Oct 1, 2024
7 tasks
@ilaflott
Copy link
Member

ilaflott commented Oct 4, 2024

OK so in light of fre-cli's add_regrid_xy PR do we want to merge this here now?

we should start a new issue/branch of dev using the new fre-cli functionality

@ilaflott
Copy link
Member

ilaflott commented Oct 4, 2024

I was hoping to be lucky enough to get the pipeline working for reviewing this. but regrid-xy in the state its in here is not pipeline-ready to be assessed this way.

Running the tests within the main branch on PPAN by hand, using a personally-built fre-cli conda environment, I do,

cd app/regrid-xy
pytest -v -v -rx tests/test_regrid_xy.py

As output i see:

platform linux -- Python 3.9.19, pytest-8.3.3, pluggy-1.5.0 -- /home/Ian.Laflotte/conda/envs/fre_cli/bin/python3.9
cachedir: .pytest_cache
rootdir: /home/Ian.Laflotte/Working/fre-workflows
configfile: pytest.ini
plugins: anyio-4.4.0, cov-5.0.0
collected 11 items

t/test_regrid_xy.py::test_make_ncgen3_nc_inputs PASSED                                                                                                                                                                                                                                                                 [  9%]
t/test_regrid_xy.py::test_make_ncgen_tile_nc_inputs PASSED                                                                                                                                                                                                                                                             [ 18%]
t/test_regrid_xy.py::test_make_ncgen_grid_spec_nc_inputs PASSED                                                                                                                                                                                                                                                        [ 27%]
t/test_regrid_xy.py::test_make_hgrid_gold_input PASSED                                                                                                                                                                                                                                                                 [ 36%]
t/test_regrid_xy.py::test_make_fregrid_comparison_input PASSED                                                                                                                                                                                                                                                         [ 45%]
t/test_regrid_xy.py::test_import_regrid_xy PASSED                                                                                                                                                                                                                                                                      [ 54%]
t/test_regrid_xy.py::test_failure_wrong_DT_regrid_xy PASSED                                                                                                                                                                                                                                                            [ 63%]
t/test_regrid_xy.py::test_success_regrid_xy PASSED                                                                                                                                                                                                                                                                     [ 72%]
t/test_regrid_xy.py::test_nccmp1_regrid_xy PASSED                                                                                                                                                                                                                                                                      [ 81%]
t/test_regrid_xy.py::test_nccmp2_regrid_xy PASSED                                                                                                                                                                                                                                                                      [ 90%]
t/test_regrid_xy.py::test_regrid_one_for_two_comps SKIPPED (TODO)                                                                                                                                                                                                                                                      [100%]

Now, I checkout this branch and do the same thing!

cd ../..
git checkout 31.use-pathlib
cd -
pytest -v -v -rx tests/test_regrid_xy.py

and i see:

platform linux -- Python 3.9.19, pytest-8.3.3, pluggy-1.5.0 -- /home/Ian.Laflotte/conda/envs/fre_cli/bin/python3.9
cachedir: .pytest_cache
rootdir: /home/Ian.Laflotte/Working/fre-workflows
configfile: pytest.ini
plugins: anyio-4.4.0, cov-5.0.0
collected 11 items

t/test_regrid_xy.py::test_make_ncgen3_nc_inputs PASSED                                                                                                                                                                                                                                                                 [  9%]
t/test_regrid_xy.py::test_make_ncgen_tile_nc_inputs PASSED                                                                                                                                                                                                                                                             [ 18%]
t/test_regrid_xy.py::test_make_ncgen_grid_spec_nc_inputs PASSED                                                                                                                                                                                                                                                        [ 27%]
t/test_regrid_xy.py::test_make_hgrid_gold_input PASSED                                                                                                                                                                                                                                                                 [ 36%]
t/test_regrid_xy.py::test_make_fregrid_comparison_input PASSED                                                                                                                                                                                                                                                         [ 45%]
t/test_regrid_xy.py::test_import_regrid_xy FAILED                                                                                                                                                                                                                                                                      [ 54%]
t/test_regrid_xy.py::test_failure_wrong_DT_regrid_xy PASSED                                                                                                                                                                                                                                                            [ 63%]
t/test_regrid_xy.py::test_success_regrid_xy FAILED                                                                                                                                                                                                                                                                     [ 72%]
t/test_regrid_xy.py::test_nccmp1_regrid_xy FAILED                                                                                                                                                                                                                                                                      [ 81%]
t/test_regrid_xy.py::test_nccmp2_regrid_xy FAILED                                                                                                                                                                                                                                                                      [ 90%]
t/test_regrid_xy.py::test_regrid_one_for_two_comps SKIPPED (TODO)                                                                                                                                                                                                                                                      [100%]

looking at the output, i see syntax errors. pylint regrid_xy.py will guide you to quick fixes i think!

Copy link
Member

@ilaflott ilaflott left a comment

Choose a reason for hiding this comment

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

see comments in main thread!

if you'd like, merge with the pipeline branch and you can get pylint feedback

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.

app/regrid-xy/regrid_xy.py should use pathlib for filepath parsing
2 participants