pypest / pypestutils

python-wrapped PEST utilities #winning
The Unlicense
11 stars 6 forks source link

Strategy for Fortran STOP #5

Open mwtoews opened 1 year ago

mwtoews commented 1 year ago

As mention in https://github.com/pypest/pypestutils/issues/3#issuecomment-1679640834 there are potential issues with the Fortran STOP statements, which will exit the Python process.

Find them in src with:

git grep -B1 -i stop

There are approx. 50 of these in src, mostly with gslib's sgsim_code.f90.

There are a few strategies:

jtwhite79 commented 1 year ago

I like first option the most bc it jives with the rest of the code. Can we use the existing functionality for setting the error message? @mwtoews , do you have a feel for how much effort it would be to patch these stops to be more amenable to library calls? Im happy to help on this front if you can work a strategy/approach..or we can divide and conquer?

mwtoews commented 1 year ago

Wrt option 1 to refactor Fortran, I'll take a look at what John as done and see if I can catch "INVALID power variogram" as a start. But also, raise this with John when you get a chance.

jtwhite79 commented 1 year ago

So do think most of the stops are sourced to the power variogram? If so, we can just trap that on the python side...

mwtoews commented 1 year ago

I've started some data validation strategies with d470ed54c99644022e5072c6ad497d7983356d38 which operate on either scalars or vectors. E.g., here for install_structured_grid: https://github.com/pypest/pypestutils/blob/d470ed54c99644022e5072c6ad497d7983356d38/pypestutils/core.py#L187-L194

These will be expanded elsewhere later.