This looks great @micaeljtoliveira. My first thought is that these tools are sufficiently general and useful beyond OM3 to justify moving them into their own package. Something to do now, later or never?
Since you asked for it, here's an attempt at a proposed restructure that I think makes things clearer for users and developers. Of course, this is all a matter of opinion so feel free to ignore all or parts of it:
om3utils/
├── __init__.py
├── config_file
│ ├── __init__.py # import all read_*.py and write_*.py functions
│ ├── mom6_input.py
│ ├── nuopc_config.py
│ └── payu_config_yaml.py
├── profiling
│ ├── __init__.py
│ ├── parser
│ │ ├── __init__.py # import ESMFProfilingParser and FMSProfilingParser
│ │ ├── base.py # contains ProfilingParser from profiling.py
│ │ ├── esmf.py # contains all of esmf_profiling.py and esmf_trace.py
│ │ └── fms.py # contains all of fms_profiling.py
│ └── analysis.py # contains all of profiling_analyses.py and parse_profiling_data from profiling.py
└── utils.py
Then the profiling tools could be used as follows:
from om3utils.profiling.parser import ESMFProfilingParser
from om3utils.profiling.analysis import (
parse_profiling_data,
scaling_efficiency
)
stats = parse_profiling_data(
run_dirs,
ESMFProfilingParser,
varname,
getvar
)
eff = scaling_efficiency(stats)
You could even import all the parsers and analysis functions in profiling.__init__.py so that one does not need to go through the parser and analysis subpackages.
(Note I'm not really sold on the name of the config_file subpackage)
Originally posted by @dougiesquire in #3 (review)
This looks great @micaeljtoliveira. My first thought is that these tools are sufficiently general and useful beyond OM3 to justify moving them into their own package. Something to do now, later or never?
Since you asked for it, here's an attempt at a proposed restructure that I think makes things clearer for users and developers. Of course, this is all a matter of opinion so feel free to ignore all or parts of it:
Then the profiling tools could be used as follows:
You could even import all the parsers and analysis functions in
profiling.__init__.pyso that one does not need to go through theparserandanalysissubpackages.(Note I'm not really sold on the name of the
config_filesubpackage)Originally posted by @dougiesquire in #3 (review)