multi-case web page #469
Replies: 4 comments 1 reply
-
@bitterbark Writing html in Python is done by embedding the desired html code in triple quotes. The contents are output using the basic file open and write methods. You can open and read existing html templates similarly. Example here There is also a library called Beautiful Soup for reading and editing existing html files if you'd rather do find+replace-style editing on an existing file. Example here |
Beta Was this translation helpful? Give feedback.
-
That code was super helpful, @wrongkindofdoctor, thanks. I have run into an issue with the pod_env_vars replacement in the html file, though. Maybe I am missing something; if so please point it out. But if not, I would value your (and anyone else reading this) opinion on how to proceed. (Please note that I don't expect an answer tonight!) First I'm going to summarize the parts of the process that are pertinent to writing the html page and saving the multi-run settings. Note that all code snippets are edited to show just what we need. The replacement of {{variables}} in the html file happens in the function
The
This works for my new multirun case writing its html file for the env vars that are used by the framework and the pod, except the Information for the multiple cases, however, is written to the yaml file
As far as I can tell, this information is not retained in the framework; If the variables are not retained, in order to get these variables into the html replacement, we need to do 2 things:
Options for 1)
Or we could use If I should proceed in this way, I am interested if you have an opinion as to how it is done, or other ideas for doing it easier. |
Beta Was this translation helpful? Give feedback.
-
@bitterbark Good catch! I neglected to pass the CASENAME, FIRSTYR, LASTYR info to the html generator portion of the code in the multirun implementation because each case has unique values for them. You can see that the templates for the the multirun PODs in src/html only contain variable name placeholders for the environment variables that apply to all cases. I like your suggestion of simply modifying the html writer (currently handled by the output_manager module to read the multirun environment variable yaml file, and can add that to the redesigned framework. |
Beta Was this translation helpful? Give feedback.
-
I'm adding it now! Will send a PR when I'm done. |
Beta Was this translation helpful? Give feedback.
-
Do we have a dynamic way to generate code in the html files to reflect the number of cases that the MDTF might be called with?
It looks like the
example_multicase.html
is set up to display a plot with a static nameThe POD I'm working on has one of these, but also individual plots:
This worked fine for one
CASENAME
but obviously now we need something more dynamic that can write and replace in the html file something like:where
N
can vary with each invocation.If there isn't something already here, I can try to write it. It would be helpful if anyone could tell me
cat
andsed
which I assume we should avoid! :)Beta Was this translation helpful? Give feedback.
All reactions