Adding parameters/observations from dataframe instances? #413
-
I am trying to build a pst file programatically, either using PstFrom or using a "blank" Pst instance (not sure what road to go down on that currently). I'm coming at this from a non-modflow perspective having done most of my previous pst setups semi-programmatically... but now I'm trying to harness what you've provided with this awesome library. But I could use some advice! I am initializing my parameterization programmatically because a) they're likely to be changed/modified and b) because of it being NOT modflow, I don't actually have input files that fit with the args/formats available in the add_parameters method in PstFrom, and I shouldn't need to. All I want is to:
Looking at an instance of PstFrom, I've noticed there is a public par_dfs attribute (and obs_dfs) attribute that I assume holds a list of dataframes get added when you call add_parameters/observations, then these dataframes get written to the pst when you call the write method. Can I bypass the add_parameters/observations methods by simply appending my dataframes here? And if so, what columns do I need them to have and what other attributes do I need to "manually" fill in? All advice appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
hey @gmerritt123 If your parameterization doesn't fit well into the |
Beta Was this translation helpful? Give feedback.
hey @gmerritt123
If your parameterization doesn't fit well into the
PstFrom
paradigm, I highly recommend creating yourTPL
andINS
files externally and then look at thePst
object and in particular thefrom_io_files
method. That will populate the dataframes for pars and obs and set up aPst
object with defaults for most values (and will populate the template and instruction file information). Then you should just need to update the forward run script and bring in the dataframe info you already assembled (bounds, etc.)