modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
507 stars 307 forks source link

bug: cannot pull CellBudgetFile records for a single package instance when there are multiple packages of the same type #2178

Closed jknightusgs closed 4 months ago

jknightusgs commented 4 months ago

I have 2 drain packages in a MF6 (v6.4.0) model. I assigned the pname variable "drnts" for one and "drnws" for the other. they show up in the name file as such: drn6 blrm.drnts drnts drn6 blrm.drnws drnws

flows for each package are saved to the cell budget binary output file. I instantiate the CellBudgetFile object. cbc = flopy.utils.CellBudgetFile(cbcfile, precision='double', verbose=True) cbc.get_unique_record_names() [b' STO-SS', b' STO-SY', b' FLOW-JA-FACE', b' DATA-SPDIS', b' WEL', b' DRN', b' GHB', b' RCH', b' RCHA', b' SFR'] get_unique_package_names(): [b'', b'NPF ', b'BLRM ']

the get_data() function only allows using "text" or "paknam" to find records. cbc.get_data(text="DRN") Returning DRN as a numpy recarray of size (655, 2) Returning DRN as a numpy recarray of size (409, 2) Returning DRN as a numpy recarray of size (655, 2) Returning DRN as a numpy recarray of size (409, 2) ...the 2 drn packages are returned for each stress period of the model

Is there a way to pull records for just one of the DRN packages? In the cbc recordarray I see that the pnames I assigned are saved in the "paknam2" field: image

but there doesn't seem to be a way to search cbc records based on the paknam2 field. alternatively, is there a way when building the model in flopy to get the pname variable assigned to "paknam" instead of "paknam2" so that I can pull cbc data with the paknam argument instead of the text argument?

thanks!

langevin-usgs commented 4 months ago

A recent addition through this PR should help. You should be able to specify paknam2 in the get_data() method. It is relatively new, so you may need to use the develop version. Will this work?

jknightusgs commented 4 months ago

amazing! Thank you!

Jake Knight

Hydrologist

520 N. Park Ave. | Suite 221 | Tucson, AZ 85719

(520) 670-6671 x3336 (office)

USGS Only - Click to Chat with Jake Knight on Microsoft @.***&topicname=Chat>


From: langevin-usgs @.> Sent: Friday, May 3, 2024 11:52 AM To: modflowpy/flopy @.> Cc: Knight, Jacob E @.>; Author @.> Subject: [EXTERNAL] Re: [modflowpy/flopy] bug: cannot pull CellBudgetFile records for a single package instance when there are multiple packages of the same type (Issue #2178)

This email has been received from outside of DOI - Use caution before clicking on links, opening attachments, or responding.

A recent addition through this PRhttps://github.com/modflowpy/flopy/pull/2050 should help. You should be able to specify paknam2 in the get_data() method. It is relatively new, so you may need to use the develop version. Will this work?

— Reply to this email directly, view it on GitHubhttps://github.com/modflowpy/flopy/issues/2178#issuecomment-2093588575, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGAWASBL7W55CGLHF2IHSV3ZAPMHHAVCNFSM6AAAAABHF7LWIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJTGU4DQNJXGU. You are receiving this because you authored the thread.Message ID: @.***>