flopy icon indicating copy to clipboard operation
flopy copied to clipboard

bug: ModflowUtlobs only loads last "continuous" block

Open dannbuckley opened this issue 1 year ago • 4 comments

Describe the bug The flopy.mf6.modflow.mfutlobs.ModflowUtlobs class does not load both of the continuous blocks from the ex-gwf-advtidal.obs file within the ex-gwf-advtidal MODFLOW 6 example. This is what the loaded class currently looks like:

package_name = obs_1
filename = ex-gwf-advtidal.obs
package_type = obs
model_or_simulation_package = model
model_name = ex-gwf-advtidal

Block continuous
--------------------
continuous
{internal}
(rec.array([('h1_13_8', 'head', (2, 12, 7), None)],
          dtype=[('obsname', 'O'), ('obstype', 'O'), ('id', 'O'), ('id2', 'O')]))

Expected behavior The class should have both continuous blocks from the observation file:

# File generated by Flopy version 3.3.6 on 12/07/2022 at 20:40:00.
BEGIN options
END options

BEGIN continuous  FILEOUT  ex-gwf-advtidal.obs.flow.csv
  icf1  flow-ja-face  1 5 6  1 6 6
END continuous  FILEOUT  ex-gwf-advtidal.obs.flow.csv

BEGIN continuous  FILEOUT  ex-gwf-advtidal.obs.head.csv
  h1_13_8  head  3 13 8
END continuous  FILEOUT  ex-gwf-advtidal.obs.head.csv

Desktop (please complete the following information):

  • OS: Windows 11
  • FloPy Version 3.5.0

dannbuckley avatar Jan 14 '24 23:01 dannbuckley

@dannbuckley, I have merged a fix for this problem into the develop branch.

spaulins-usgs avatar Jan 22 '24 21:01 spaulins-usgs

Hey @spaulins-usgs,

I can confirm that the data is there:

>>> model.get_package("obs_1").continuous.get_data()
{'ex-gwf-advtidal.obs.flow.csv': rec.array([('icf1', 'flow-ja-face', (0, 4, 5), (0, 5, 5))],
           dtype=[('obsname', 'O'), ('obstype', 'O'), ('id', 'O'), ('id2', 'O')]),
 'ex-gwf-advtidal.obs.head.csv': rec.array([('h1_13_8', 'head', (2, 12, 7), None)],
           dtype=[('obsname', 'O'), ('obstype', 'O'), ('id', 'O'), ('id2', 'O')])}

The class summary still looks like it does in the original comment:

>>> model.get_package("obs_1")
package_name = obs_1
filename = ex-gwf-advtidal.obs
package_type = obs
model_or_simulation_package = model
model_name = ex-gwf-advtidal

Block continuous
--------------------
continuous
{internal}
(rec.array([('h1_13_8', 'head', (2, 12, 7), None)],
          dtype=[('obsname', 'O'), ('obstype', 'O'), ('id', 'O'), ('id2', 'O')]))

dannbuckley avatar Jan 23 '24 00:01 dannbuckley

@dannbuckley, yes the class summary is being abbreviated when there are multiple blocks of the same type. It also gets abbreviated for stress period data. I will discuss with the rest of the flopy team the best way to display the class summary in these cases. Note that it is probably best to abbreviate the class summary in at least some cases since there can be 100s or even 1000s of stress periods in some models.

spaulins-usgs avatar Jan 24 '24 18:01 spaulins-usgs

@spaulins-usgs That makes sense. In that case, then, it might be easier to print the number of instances of the block within the package instead of printing all the data (e.g., "continuous: 100 blocks" or similar). Also, printing something like "only last block shown" or similar might help.

dannbuckley avatar Jan 24 '24 20:01 dannbuckley