diff --git a/autotest/test_prtfile.py b/autotest/test_prtfile.py new file mode 100644 index 0000000000..39b7850fc4 --- /dev/null +++ b/autotest/test_prtfile.py @@ -0,0 +1,45 @@ +from pathlib import Path + +import pytest + +from autotest.conftest import get_project_root_path +from flopy.utils.prtfile import PathlineFile + +pytestmark = pytest.mark.mf6 +prt_data_path = ( + get_project_root_path() / "examples" / "data" / "mf6" / "prt_data" / "001" +) + + +@pytest.mark.parametrize( + "path, header_path", + [ + (Path(prt_data_path) / "prt001.trk", None), + ( + Path(prt_data_path) / "prt001.trk", + Path(prt_data_path) / "prt001.trk.hdr", + ), + (Path(prt_data_path) / "prt001.trk.csv", None), + ], +) +def test_init(path, header_path): + file = PathlineFile(path, header_filename=header_path) + assert file.fname == path + assert file.dtype == PathlineFile.dtypes["full"] + if path.suffix == ".csv": + assert len(file._data) == len(open(path).readlines()) - 1 + + +@pytest.mark.parametrize( + "path", + [ + Path(prt_data_path) / "prt001.trk", + Path(prt_data_path) / "prt001.trk.csv", + ], +) +def test_intersect(path): + file = PathlineFile(path) + nodes = [1, 11, 21] + intersection = file.intersect(nodes) + assert any(intersection) + assert all(d.icell in nodes for d in intersection.itertuples()) diff --git a/examples/data/mf6/prt_data/001/prt001.trk b/examples/data/mf6/prt_data/001/prt001.trk new file mode 100644 index 0000000000..593ca09302 Binary files /dev/null and b/examples/data/mf6/prt_data/001/prt001.trk differ diff --git a/examples/data/mf6/prt_data/001/prt001.trk.csv b/examples/data/mf6/prt_data/001/prt001.trk.csv new file mode 100644 index 0000000000..0b846c480f --- /dev/null +++ b/examples/data/mf6/prt_data/001/prt001.trk.csv @@ -0,0 +1,181 @@ +kper,kstp,imdl,iprp,irpt,ilay,icell,izone,istatus,ireason,trelease,t,x,y,z,name +1,1,1,1,1,1,1,0,1,0,.000000000000000,.000000000000000,.1000000000000000,9.100000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,1,0,1,1,.000000000000000,.6345986517174945E-01,.1111111111111111,9.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,11,0,1,1,.000000000000000,.8304308339182425,.1840201091047777,8.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,21,0,1,1,.000000000000000,2.026389948294649,.2675956324493809,7.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,31,0,1,1,.000000000000000,3.704265435673124,.3606040744154423,6.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,41,0,1,1,.000000000000000,5.928937232170627,.4696105785642022,5.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,51,0,1,1,.000000000000000,8.827842277987040,.6123549075346494,4.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,61,0,1,1,.000000000000000,12.68120183411981,.8315419220952132,3.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,71,0,1,1,.000000000000000,15.14939193559672,1.000000000000000,2.499948317631721,.5000000000000000,PRP000000001 +1,1,1,1,1,1,72,0,1,1,.000000000000000,18.21418587905050,1.255970885130385,2.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,82,0,1,1,.000000000000000,24.57630394377621,2.000000000000000,1.255876098210262,.5000000000000000,PRP000000001 +1,1,1,1,1,1,83,0,1,1,.000000000000000,27.64079914213009,2.499702722804964,1.000000000000000,.5000000000000000,PRP000000001 +1,1,1,1,1,1,93,0,1,1,.000000000000000,30.11083496453177,3.000000000000000,.8314848596408819,.5000000000000000,PRP000000001 +1,1,1,1,1,1,94,0,1,1,.000000000000000,33.96453146615585,4.000000000000000,.6122853298161113,.5000000000000000,PRP000000001 +1,1,1,1,1,1,95,0,1,1,.000000000000000,36.86342560027116,5.000000000000000,.4694741172286391,.5000000000000000,PRP000000001 +1,1,1,1,1,1,96,0,1,1,.000000000000000,39.08799504314657,6.000000000000000,.3604128606742599,.5000000000000000,PRP000000001 +1,1,1,1,1,1,97,0,1,1,.000000000000000,40.76579383248019,7.000000000000000,.2674032132676457,.5000000000000000,PRP000000001 +1,1,1,1,1,1,98,0,1,1,.000000000000000,41.96175836497356,8.000000000000000,.1838899700554665,.5000000000000000,PRP000000001 +1,1,1,1,1,1,99,0,1,1,.000000000000000,42.72875484883790,9.000000000000000,.1110317990610085,.5000000000000000,PRP000000001 +1,1,1,1,1,1,100,0,5,3,.000000000000000,42.72875484883790,9.000000000000000,.1110317990610085,.5000000000000000,PRP000000001 +1,1,1,1,2,1,1,0,1,0,.000000000000000,.000000000000000,.2000000000000000,9.199999999999999,.5000000000000000,PRP000000002 +1,1,1,1,2,1,1,0,1,1,.000000000000000,.1344019587597114,.2499999999999998,9.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,11,0,1,1,.000000000000000,.9013729275062045,.4140452454857496,8.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,21,0,1,1,.000000000000000,2.097332041882611,.6020901730111069,7.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,31,0,1,1,.000000000000000,3.775207529261086,.8113591674347448,6.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,41,0,1,1,.000000000000000,5.535959045252451,1.000000000000000,5.187314016456632,.5000000000000000,PRP000000002 +1,1,1,1,2,1,42,0,1,1,.000000000000000,6.037268307514641,1.060833070496150,5.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,52,0,1,1,.000000000000000,9.106420685909395,1.393711253205838,4.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,62,0,1,1,.000000000000000,13.08389057699164,1.889676216739610,3.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,72,0,1,1,.000000000000000,13.86103602973066,2.000000000000000,2.835798404653227,.5000000000000000,PRP000000002 +1,1,1,1,2,1,73,0,1,1,.000000000000000,18.71985648382454,2.835487432134109,2.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,83,0,1,1,.000000000000000,19.49876924392792,3.000000000000000,1.889402280179934,.5000000000000000,PRP000000002 +1,1,1,1,2,1,84,0,1,1,.000000000000000,23.47729073062385,4.000000000000000,1.393288754623582,.5000000000000000,PRP000000002 +1,1,1,1,2,1,85,0,1,1,.000000000000000,26.54694563326774,5.000000000000000,1.060289778364293,.5000000000000000,PRP000000002 +1,1,1,1,2,1,86,0,1,1,.000000000000000,27.04342109091038,5.185449557844453,1.000000000000000,.5000000000000000,PRP000000002 +1,1,1,1,2,1,96,0,1,1,.000000000000000,28.80857582239105,6.000000000000000,.8107730357146236,.5000000000000000,PRP000000002 +1,1,1,1,2,1,97,0,1,1,.000000000000000,30.48637461172467,7.000000000000000,.6015415614616489,.5000000000000000,PRP000000002 +1,1,1,1,2,1,98,0,1,1,.000000000000000,31.68233914421804,8.000000000000000,.4136728888653385,.5000000000000000,PRP000000002 +1,1,1,1,2,1,99,0,1,1,.000000000000000,32.44933562808238,9.000000000000000,.2497735197826673,.5000000000000000,PRP000000002 +1,1,1,1,2,1,100,0,5,3,.000000000000000,32.44933562808238,9.000000000000000,.2497735197826673,.5000000000000000,PRP000000002 +1,1,1,1,3,1,1,0,1,0,.000000000000000,.000000000000000,.3000000100000000,9.300000010000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,1,0,1,1,.000000000000000,.2148294796940043,.4285714489795920,9.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,11,0,1,1,.000000000000000,.9818004484404974,.7097918832037549,8.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,21,0,1,1,.000000000000000,2.076672298776422,1.000000000000000,7.070796968014615,.5000000000000000,PRP000000003 +1,1,1,1,3,1,22,0,1,1,.000000000000000,2.203617375414431,1.040006660846159,7.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,32,0,1,1,.000000000000000,4.197575775002937,1.441947406746180,6.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,42,0,1,1,.000000000000000,6.651816678925318,1.871780191137267,5.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,52,0,1,1,.000000000000000,7.437614407292212,2.000000000000000,4.721197504307768,.5000000000000000,PRP000000003 +1,1,1,1,3,1,53,0,1,1,.000000000000000,9.908198040138020,2.445425140413097,4.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,63,0,1,1,.000000000000000,12.75938925953464,3.000000000000000,3.286986537810564,.5000000000000000,PRP000000003 +1,1,1,1,3,1,64,0,1,1,.000000000000000,14.07202735612326,3.286925213146775,3.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,74,0,1,1,.000000000000000,16.92425797975483,4.000000000000000,2.445118081984156,.5000000000000000,PRP000000003 +1,1,1,1,3,1,75,0,1,1,.000000000000000,19.39266639551562,4.720393535467641,2.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,85,0,1,1,.000000000000000,20.18090342207207,5.000000000000000,1.871355668916179,.5000000000000000,PRP000000003 +1,1,1,1,3,1,86,0,1,1,.000000000000000,22.63520742498483,6.000000000000000,1.441478618996614,.5000000000000000,PRP000000003 +1,1,1,1,3,1,87,0,1,1,.000000000000000,24.62882950801743,7.000000000000000,1.039525413044098,.5000000000000000,PRP000000003 +1,1,1,1,3,1,88,0,1,1,.000000000000000,24.75426166980228,7.069965645493071,1.000000000000000,.5000000000000000,PRP000000003 +1,1,1,1,3,1,98,0,1,1,.000000000000000,25.85030962625330,8.000000000000000,.7095393993518588,.5000000000000000,PRP000000003 +1,1,1,1,3,1,99,0,1,1,.000000000000000,26.61730611011764,9.000000000000000,.4284161664224617,.5000000000000000,PRP000000003 +1,1,1,1,3,1,100,0,5,3,.000000000000000,26.61730611011764,9.000000000000000,.4284161664224617,.5000000000000000,PRP000000003 +1,1,1,1,4,1,1,0,1,0,.000000000000000,.000000000000000,.4000000100000000,9.400000009999999,.5000000000000000,PRP000000004 +1,1,1,1,4,1,1,0,1,1,.000000000000000,.3076762301867217,.6666666944444444,9.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,11,0,1,1,.000000000000000,.9240708715396757,1.000000000000000,8.158676803349870,.5000000000000000,PRP000000004 +1,1,1,1,4,1,12,0,1,1,.000000000000000,1.165313120694530,1.158689414248265,8.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,22,0,1,1,.000000000000000,2.819821295801787,1.753424270226212,7.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,32,0,1,1,.000000000000000,3.744508416699555,2.000000000000000,6.511022764165868,.5000000000000000,PRP000000004 +1,1,1,1,4,1,33,0,1,1,.000000000000000,5.060556757909990,2.377042167827183,6.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,43,0,1,1,.000000000000000,7.654780984694812,3.000000000000000,5.079379949475653,.5000000000000000,PRP000000004 +1,1,1,1,4,1,44,0,1,1,.000000000000000,7.922308268687384,3.068752132115875,5.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,54,0,1,1,.000000000000000,11.52558583084959,3.940033608666633,4.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,64,0,1,1,.000000000000000,11.75758115458850,4.000000000000000,3.940025436039324,.5000000000000000,PRP000000004 +1,1,1,1,4,1,65,0,1,1,.000000000000000,15.36106354187710,5.000000000000000,3.068656396580068,.5000000000000000,PRP000000004 +1,1,1,1,4,1,66,0,1,1,.000000000000000,15.62822018489717,5.079271523708384,3.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,76,0,1,1,.000000000000000,18.22255665479527,6.000000000000000,2.377004299951427,.5000000000000000,PRP000000004 +1,1,1,1,4,1,77,0,1,1,.000000000000000,19.53853998567526,6.511101406612429,2.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,87,0,1,1,.000000000000000,20.46286482342002,7.000000000000000,1.753519533203051,.5000000000000000,PRP000000004 +1,1,1,1,4,1,88,0,1,1,.000000000000000,22.11719341120610,8.000000000000000,1.158823369731619,.5000000000000000,PRP000000004 +1,1,1,1,4,1,89,0,1,1,.000000000000000,22.35864609922380,8.158809921188507,1.000000000000000,.5000000000000000,PRP000000004 +1,1,1,1,4,1,99,0,1,1,.000000000000000,22.97494147400282,9.000000000000000,.6667156763397112,.5000000000000000,PRP000000004 +1,1,1,1,4,1,100,0,5,3,.000000000000000,22.97494147400282,9.000000000000000,.6667156763397112,.5000000000000000,PRP000000004 +1,1,1,1,5,1,1,0,1,0,.000000000000000,.000000000000000,.5000000000000000,9.500000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,1,0,1,1,.000000000000000,.4174906163649280,1.000000000000000,9.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,2,0,1,1,.000000000000000,.4174906163649280,1.000000000000000,9.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,12,0,1,1,.000000000000000,1.937707010745450,2.000000000000000,8.000079469058820,.5000000000000000,PRP000000005 +1,1,1,1,5,1,13,0,1,1,.000000000000000,1.937897716737432,2.000125435399617,8.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,23,0,1,1,.000000000000000,4.337324478275523,3.000000000000000,7.000158206878864,.5000000000000000,PRP000000005 +1,1,1,1,5,1,24,0,1,1,.000000000000000,4.337822861659189,3.000207674524930,7.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,34,0,1,1,.000000000000000,7.487339238772278,4.000000000000000,6.000130787901094,.5000000000000000,PRP000000005 +1,1,1,1,5,1,35,0,1,1,.000000000000000,7.487809876540122,4.000149411454049,6.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,45,0,1,1,.000000000000000,11.08573482205339,5.000000000000000,5.000114103070649,.5000000000000000,PRP000000005 +1,1,1,1,5,1,46,0,1,1,.000000000000000,11.08614540071765,5.000114101964002,5.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,56,0,1,1,.000000000000000,14.68403544778846,6.000000000000000,4.000123769334058,.5000000000000000,PRP000000005 +1,1,1,1,5,1,57,0,1,1,.000000000000000,14.68442525571463,6.000108329612469,4.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,67,0,1,1,.000000000000000,17.83379884218993,7.000000000000000,3.000108311931065,.5000000000000000,PRP000000005 +1,1,1,1,5,1,68,0,1,1,.000000000000000,17.83405870643099,7.000082496912824,3.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,78,0,1,1,.000000000000000,20.23326379385776,8.000000000000000,2.000082483570943,.5000000000000000,PRP000000005 +1,1,1,1,5,1,79,0,1,1,.000000000000000,20.23338920270048,8.000052262118526,2.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,89,0,1,1,.000000000000000,21.75363330539578,9.000000000000000,1.000052267380652,.5000000000000000,PRP000000005 +1,1,1,1,5,1,90,0,1,1,.000000000000000,21.75366478813337,9.000020708747167,1.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,5,1,100,0,5,3,.000000000000000,21.75366478813337,9.000020708747167,1.000000000000000,.5000000000000000,PRP000000005 +1,1,1,1,6,1,1,0,1,0,.000000000000000,.000000000000000,.6000000200000000,9.600000020000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,1,0,1,1,.000000000000000,.3076762000711404,1.000000000000000,9.333333388888887,.5000000000000000,PRP000000006 +1,1,1,1,6,1,2,0,1,1,.000000000000000,.9240710314511431,1.841323406980941,9.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,12,0,1,1,.000000000000000,1.165293789563162,2.000000000000000,8.841336016860446,.5000000000000000,PRP000000006 +1,1,1,1,6,1,13,0,1,1,.000000000000000,2.819801964670423,3.000000000000000,8.246605917483054,.5000000000000000,PRP000000006 +1,1,1,1,6,1,14,0,1,1,.000000000000000,3.744607781601528,3.489037099745424,8.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,24,0,1,1,.000000000000000,5.060505748680252,4.000000000000000,7.623002001638187,.5000000000000000,PRP000000006 +1,1,1,1,6,1,25,0,1,1,.000000000000000,7.654926540429770,4.920685329586415,7.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,35,0,1,1,.000000000000000,7.922234454245331,5.000000000000000,6.931304407347144,.5000000000000000,PRP000000006 +1,1,1,1,6,1,36,0,1,1,.000000000000000,11.52551201640753,6.000000000000000,6.060030743421259,.5000000000000000,PRP000000006 +1,1,1,1,6,1,37,0,1,1,.000000000000000,11.75775770078962,6.060038924907667,6.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,47,0,1,1,.000000000000000,15.36124008807822,6.931400152333666,5.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,57,0,1,1,.000000000000000,15.62817732214757,7.000000000000000,4.920793768273893,.5000000000000000,PRP000000006 +1,1,1,1,6,1,58,0,1,1,.000000000000000,18.22271040318674,7.623039881680662,4.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,68,0,1,1,.000000000000000,19.53854331473988,8.000000000000000,3.488958488764992,.5000000000000000,PRP000000006 +1,1,1,1,6,1,69,0,1,1,.000000000000000,20.46298688791669,8.246510667273593,3.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,79,0,1,1,.000000000000000,22.11731547570277,8.841202071173459,2.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,89,0,1,1,.000000000000000,22.35872948664267,9.000000000000000,1.841215517967525,.5000000000000000,PRP000000006 +1,1,1,1,6,1,90,0,1,1,.000000000000000,22.97504784393619,9.333294402737220,1.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,6,1,100,0,5,3,.000000000000000,22.97504784393619,9.333294402737220,1.000000000000000,.5000000000000000,PRP000000006 +1,1,1,1,7,1,1,0,1,0,.000000000000000,.000000000000000,.6999999900000000,9.699999990000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,1,0,1,1,.000000000000000,.2148294796940044,1.000000000000000,9.571428551020409,.5000000000000000,PRP000000007 +1,1,1,1,7,1,2,0,1,1,.000000000000000,.9818004484404983,2.000000000000000,9.290208116796245,.5000000000000000,PRP000000007 +1,1,1,1,7,1,3,0,1,1,.000000000000000,2.076672298776415,2.929203031985378,9.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,13,0,1,1,.000000000000000,2.203617375414436,3.000000000000000,8.959993339153836,.5000000000000000,PRP000000007 +1,1,1,1,7,1,14,0,1,1,.000000000000000,4.197575775002941,4.000000000000000,8.558052593253812,.5000000000000000,PRP000000007 +1,1,1,1,7,1,15,0,1,1,.000000000000000,6.651816678925319,5.000000000000000,8.128219808862726,.5000000000000000,PRP000000007 +1,1,1,1,7,1,16,0,1,1,.000000000000000,7.437614407292165,5.278802495692215,8.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,26,0,1,1,.000000000000000,9.908198040138014,6.000000000000000,7.554574859586896,.5000000000000000,PRP000000007 +1,1,1,1,7,1,27,0,1,1,.000000000000000,12.75938925953459,6.713013462189426,7.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,37,0,1,1,.000000000000000,14.07202735612326,7.000000000000000,6.713074786853214,.5000000000000000,PRP000000007 +1,1,1,1,7,1,38,0,1,1,.000000000000000,16.92425797975478,7.554881918015834,6.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,48,0,1,1,.000000000000000,19.39266639551562,8.000000000000000,5.279606464532343,.5000000000000000,PRP000000007 +1,1,1,1,7,1,49,0,1,1,.000000000000000,20.18090342207203,8.128644331083812,5.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,59,0,1,1,.000000000000000,22.63520742498477,8.558521381003381,4.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,69,0,1,1,.000000000000000,24.62882950801737,8.960474586955897,3.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,79,0,1,1,.000000000000000,24.75426166980224,9.000000000000000,2.930034354506921,.5000000000000000,PRP000000007 +1,1,1,1,7,1,80,0,1,1,.000000000000000,25.85030962625325,9.290460600648139,2.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,90,0,1,1,.000000000000000,26.61730611011759,9.571583833577536,1.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,7,1,100,0,5,3,.000000000000000,26.61730611011759,9.571583833577536,1.000000000000000,.5000000000000000,PRP000000007 +1,1,1,1,8,1,1,0,1,0,.000000000000000,.000000000000000,.8000000100000000,9.800000010000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,1,0,1,1,.000000000000000,.1344019512308165,1.000000000000000,9.750000015625000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,2,0,1,1,.000000000000000,.9013729199773104,2.000000000000000,9.585954780392077,.5000000000000000,PRP000000008 +1,1,1,1,8,1,3,0,1,1,.000000000000000,2.097332034353719,3.000000000000000,9.397909864619525,.5000000000000000,PRP000000008 +1,1,1,1,8,1,4,0,1,1,.000000000000000,3.775207521732195,4.000000000000000,9.188640883275196,.5000000000000000,PRP000000008 +1,1,1,1,8,1,5,0,1,1,.000000000000000,5.535959564152013,4.812686202004050,9.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,15,0,1,1,.000000000000000,6.037268254292059,5.000000000000000,8.939167000453050,.5000000000000000,PRP000000008 +1,1,1,1,8,1,16,0,1,1,.000000000000000,9.106420632686824,6.000000000000000,8.606288836540338,.5000000000000000,PRP000000008 +1,1,1,1,8,1,17,0,1,1,.000000000000000,13.08389052376908,7.000000000000000,8.110323902719321,.5000000000000000,PRP000000008 +1,1,1,1,8,1,18,0,1,1,.000000000000000,13.86103684171424,7.164201773142255,8.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,28,0,1,1,.000000000000000,18.71985641123550,8.000000000000000,7.164512745583430,.5000000000000000,PRP000000008 +1,1,1,1,8,1,29,0,1,1,.000000000000000,19.49877003654247,8.110597839292595,7.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,39,0,1,1,.000000000000000,23.47729152323840,8.606711335111470,6.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,49,0,1,1,.000000000000000,26.54694642588228,8.939710292575988,5.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,59,0,1,1,.000000000000000,27.04342131175283,9.000000000000000,4.814550660372381,.5000000000000000,PRP000000008 +1,1,1,1,8,1,60,0,1,1,.000000000000000,28.80857656933874,9.189227014975872,4.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,70,0,1,1,.000000000000000,30.48637535867236,9.398458476147445,3.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,80,0,1,1,.000000000000000,31.68233989116573,9.586327136997982,2.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,90,0,1,1,.000000000000000,32.44933637503007,9.750226495833470,1.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,8,1,100,0,5,3,.000000000000000,32.44933637503007,9.750226495833470,1.000000000000000,.5000000000000000,PRP000000008 +1,1,1,1,9,1,1,0,1,0,.000000000000000,.000000000000000,.8999999800000000,9.899999980000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,1,0,1,1,.000000000000000,.6345987855645296E-01,1.000000000000000,9.888888864197531,.5000000000000000,PRP000000009 +1,1,1,1,9,1,2,0,1,1,.000000000000000,.8304308473029468,2.000000000000000,9.815979850001865,.5000000000000000,PRP000000009 +1,1,1,1,9,1,3,0,1,1,.000000000000000,2.026389961679355,3.000000000000000,9.732404308084922,.5000000000000000,PRP000000009 +1,1,1,1,9,1,4,0,1,1,.000000000000000,3.704265449057832,4.000000000000000,9.639395845450316,.5000000000000000,PRP000000009 +1,1,1,1,9,1,5,0,1,1,.000000000000000,5.928937245555336,5.000000000000000,9.530389317077885,.5000000000000000,PRP000000009 +1,1,1,1,9,1,6,0,1,1,.000000000000000,8.827842291371752,6.000000000000000,9.387644956386470,.5000000000000000,PRP000000009 +1,1,1,1,9,1,7,0,1,1,.000000000000000,12.68120184750453,7.000000000000000,9.168457893117671,.5000000000000000,PRP000000009 +1,1,1,1,9,1,8,0,1,1,.000000000000000,15.14938897572776,7.500051133825171,9.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,18,0,1,1,.000000000000000,18.21418594018942,8.000000000000000,8.744028834033367,.5000000000000000,PRP000000009 +1,1,1,1,9,1,19,0,1,1,.000000000000000,24.57630095531389,8.744123620991481,8.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,29,0,1,1,.000000000000000,27.64079917480293,9.000000000000000,7.500296728865826,.5000000000000000,PRP000000009 +1,1,1,1,9,1,30,0,1,1,.000000000000000,30.11083202407352,9.168514955661681,7.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,40,0,1,1,.000000000000000,33.96452852569760,9.387714534177162,6.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,50,0,1,1,.000000000000000,36.86342265981291,9.530525778487238,5.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,60,0,1,1,.000000000000000,39.08799210268831,9.639587059267356,4.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,70,0,1,1,.000000000000000,40.76579089202193,9.732596727334171,3.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,80,0,1,1,.000000000000000,41.96175542451530,9.816109989097118,2.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,90,0,1,1,.000000000000000,42.72875190837964,9.888968176275537,1.000000000000000,.5000000000000000,PRP000000009 +1,1,1,1,9,1,100,0,5,3,.000000000000000,42.72875190837964,9.888968176275537,1.000000000000000,.5000000000000000,PRP000000009 diff --git a/examples/data/mf6/prt_data/001/prt001.trk.hdr b/examples/data/mf6/prt_data/001/prt001.trk.hdr new file mode 100644 index 0000000000..c5fb8481e9 --- /dev/null +++ b/examples/data/mf6/prt_data/001/prt001.trk.hdr @@ -0,0 +1,2 @@ +kper,kstp,imdl,iprp,irpt,ilay,icell,izone,istatus,ireason,trelease,t,x,y,z,name + Union[List[np.recarray], np.recarray]: - if isinstance(cells, (list, tuple)): - allint = all(isinstance(el, int) for el in cells) - if allint: - t = [] - for el in cells: - t.append((el,)) - cells = t - - icell = self._data[["icell"]] - cells = np.array(cells, dtype=icell.dtype) - inds = np.in1d(icell, cells) - epdest = self._data[inds].copy().view(np.recarray) + """Find intersection of pathlines with cells.""" + + if not all(isinstance(nn, int) for nn in cells): + raise ValueError("Expected integer cell numbers") + + idxs = np.in1d(self._data[["icell"]], np.array(cells, dtype=np.int32)) + sect = self._data[idxs].copy() + pids = np.unique(sect["particleid"]) if to_recarray: - # use particle ids to get the rest of the paths - inds = np.in1d(self._data["particleid"], epdest.particleid) - series = self._data[inds].copy() - series.sort(order=["particleid", "time"]) - series = series.view(np.recarray) + idxs = np.in1d(sect["particleid"], pids) + return sect[idxs].sort_values(by=["particleid", "time"]) else: - # collect unique particleids in selection - partids = np.unique(epdest["particleid"]) - series = [self.get_data(partid) for partid in partids] - - return series + return [self.get_data(pid) for pid in pids]