QSWATMOD

1,454 views
Skip to first unread message

Vahid Rafie

unread,
Dec 8, 2020, 10:14:55 PM12/8/20
to SWAT-MODFLOW
Dear Park, 

Would you please share me just the python script that you used in QSWATMOD2 for exporting the monthly/yearly results to the shapefile?

I see that in QSWATMOD, this is no possible to export NO3/P results to the shapefile.   

Cheers
Vahid 

Seonggyu Park

unread,
Dec 9, 2020, 11:13:41 AM12/9/20
to SWAT-MODFLOW
Hi Vahid,

Here is a link to a python script related to exporting the monthly/yearly results to the shapefile.

Also, I will work on RT3D options soon and update it soon.

Thanks,
Seonggyu

sury...@gmail.com

unread,
Apr 29, 2021, 9:38:32 AM4/29/21
to SWAT-MODFLOW

hi,
i am trying to build SWAT-MODFLOW model using QSWAT gui,  while linking the these two i am getting these error, 

Intersecting DHRUs by GRIDs ... processing not done

can you pls suggest me in this regard

An error has occurred while executing Python code:

IndexError: list index out of range

Traceback (most recent call last):
  File "C:/Users/DELL/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\QSWATMOD2.py", line 1698, in geoprocessing_prepared
    linking_process.dhru_grid(self)
  File "C:/Users/DELL/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\pyfolder\linking_process.py", line 314, in dhru_grid
    input2 = QgsProject.instance().mapLayersByName("mf_grid (MODFLOW)")[0]
IndexError: list index out of range

Best Regards

Heou Maleki

unread,
Apr 29, 2021, 10:07:59 AM4/29/21
to SWAT-MODFLOW
Hi

I had this error before and I think you should make sure that in the Pre-Processing panel you selected wether you want to use MODFLOW river package or SWAT river network. for the first case, make sure that you selected For Shared cells MODFLOW or SWAT and then Identify river celles and create "river_grid" shapefile. I think this error occured in my case because something went wrong at that step.

Heou Maleki

sury...@gmail.com

unread,
Apr 29, 2021, 11:11:36 AM4/29/21
to SWAT-MODFLOW
hi thank you.
I tried with both options, but i am getting the following error while creating river grid.

input1 = QgsProject.instance().mapLayersByName("mf_grid (MODFLOW)")[0]


             IndexError: list index out of range

            2021-04-29T20:39:27     WARNING    Traceback (most recent call last):

              File "C:/Users/DELL/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\QSWATMOD2.py", line 662, in create_rivs
              modflow_functions.mf_riv2(self)
              File "C:/Users/DELL/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\pyfolder\modflow_functions.py", line 521, in mf_riv2
              input1 = QgsProject.instance().mapLayersByName("mf_grid (MODFLOW)")[0]


             IndexError: list index out of range
             

2021-04-29T20:39:27     WARNING    Traceback (most recent call last):
              File "C:/Users/DELL/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\QSWATMOD2.py", line 662, in create_rivs
              modflow_functions.mf_riv2(self)
              File "C:/Users/DELL/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\pyfolder\modflow_functions.py", line 521, in mf_riv2
              input1 = QgsProject.instance().mapLayersByName("mf_grid (MODFLOW)")[0]

sury...@gmail.com

unread,
Apr 29, 2021, 2:49:35 PM4/29/21
to SWAT-MODFLOW
Hi Vahid,
my model successfully ran. But, SW-GW interactions were not successful may be because of river grid shape not created.  But, when i created it says river gird cells identified and created. But actually it is not created, any idea on this problem.

Regards
Suri

On Wednesday, December 9, 2020 at 8:44:55 AM UTC+5:30 vahi...@gmail.com wrote:

Seonggyu Park

unread,
Apr 30, 2021, 12:47:39 AM4/30/21
to SWAT-MODFLOW
Thank you @Heou Maleki.

Hi Suri,

If you share your QSWATMOD project and qgis file, I will take a look and see what is happening.

Best,
Seonggyu

sury...@gmail.com

unread,
May 26, 2021, 7:26:44 AM5/26/21
to SWAT-MODFLOW
Hi Seonggyu,
Thank you. Now I have created a new model, and getting errors while linking , saying duplicate rows. MODFLOW model and grid shape files are created in MODELMUSE.  I have attached errors msgs and gridshp here. Please suggest me go forward.
Best Regards
Suri

errormsg_gridshp.rar

Seonggyu Park

unread,
May 31, 2021, 11:05:13 PM5/31/21
to SWAT-MODFLOW
Hi Suri,

I found there is an issue with the field name (row) ModelMuse and QSWATMOD share. I will fix this issue in the next version of QSWATMOD.
For now, use the attached shapefile I modified, please. Also, you need to define this shapefile's projection. I suggest you project it with the same projection as a SWAT input shapefile.

Best,
Seonggyu
MODFLOWGridSHP.zip

sury...@gmail.com

unread,
Jun 2, 2021, 6:37:15 AM6/2/21
to SWAT-MODFLOW
Thank you, Seonggyu for the help. 
I have tried as you suggested but problem still persists in linking process. 
I am attaching QSWATMOD (google drive) project here , (https://drive.google.com/file/d/1OG8EeZscZbXJzEXAlf028iHq1DFfJECt/view?usp=sharing)

and 

Error msg: 

2021-06-02T16:02:44     WARNING    Traceback (most recent call last):
              File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\QSWATMOD2.py", line 1677, in geoprocessing_prepared  linking_process.create_dhru_id(self)
              File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\pyfolder\linking_process.py", line 116, in create_dhru_id   featureList = sorted(aList, key=lambda f: f[field1Id])
              File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\pyfolder\linking_process.py", line 116, in  featureList = sorted(aList, key=lambda f: f[field1Id])
             KeyError: '-1'


Thank you
Suri

sury...@gmail.com

unread,
Jun 2, 2021, 1:18:37 PM6/2/21
to SWAT-MODFLOW
Hi Seonggyu, 
have you able to download the project folder now.

Regards
Suri

Seonggyu Park

unread,
Jun 2, 2021, 4:12:48 PM6/2/21
to SWAT-MODFLOW
Yes, I was. I will take a look and get back to you soon.

--
You received this message because you are subscribed to a topic in the Google Groups "SWAT-MODFLOW" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swat-modflow/-o-CJOUEX18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swat-modflow...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swat-modflow/d4db6b63-ed87-4cca-904d-dcd7078076a1n%40googlegroups.com.

sury...@gmail.com

unread,
Jun 3, 2021, 2:44:37 AM6/3/21
to SWAT-MODFLOW
Thank you. 

Seonggyu Park

unread,
Jun 4, 2021, 11:20:50 AM6/4/21
to SWAT-MODFLOW, sury...@gmail.com

Hi Suri,

I linked your SWAT with MODFLOW model successfully.

The problem was the hru shapefile doesn’t have HRU_ID field; instead, it has “HRUGIS” field. I thought I added an option for this issue in the latest version of QSWATMOD, but still, it’s problematic because the name of the field to generate HRU_ID is sometimes different. I will fix this issue in a later version.

I generated HRU_ID in your hru shapefile temporarily.

You have another issue with your MODFLOW model. You are missing a recharge package and it is required to get deep percolation from the SWAT model. You can provide zero value for the recharge rate.

Once you create the recharge package, you can just import the MODFLOW model again, then click the “Check MODFLOW file” button and run your model. You don’t have to relink your model.

Here is a link to your model.


Please let me know if you have any questions or other issues.

Best,

Seonggyu


You received this message because you are subscribed to the Google Groups "SWAT-MODFLOW" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swat-modflow...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swat-modflow/69ebe0a8-ee97-49cd-bd10-40251e7c8550n%40googlegroups.com.

Surya

unread,
Jun 4, 2021, 1:58:51 PM6/4/21
to Seonggyu Park, SWAT-MODFLOW
Dear Seonggyu,
Thank you so much. Your help is much appreciated and will be acknowledged.
Yes, it was successful and running smoothly. But after four years of run time, it is stopped automatically, i have setup the model to run from 1980 to 2017, but it ran until 1984 only. 
I got this following error. 

2021-06-04T22:47:35     WARNING    Traceback (most recent call last):
              File "C:/Users/Administrator/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATMOD2\QSWATMOD2.py", line 1256, in selectExistingMODFLOWModelDir
              shutil.copy2(os.path.join(directory, i), Out_folder)
              File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\shutil.py", line 257, in copy2
              copyfile(src, dst, follow_symlinks=follow_symlinks)
              File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\shutil.py", line 120, in copyfile
              with open(src, 'rb') as fsrc:
             PermissionError: [Errno 13] Permission denied: 'C:/Users/Administrator/Desktop/integratedModel/MODFLOW\\MODFLOWMODEL'


** I have activated well package in MODFLOW model and pumping wells were imported MODFLOW model, but these are reflecting in SWAT-MOD,

*** It seems river package was not written to SWAT-MODFLOW.

*** I also have verified groundwater-surface interactions for the four year that model had run, is not showing any interations. It is beacause river is not written.

I have attached the model again after importing the MODFLOW model, with trial runs of SWAT-MOD. Also I am attaching MODFLOW source files for your suggestions.


Best Wishes,

Suri





             

sury...@gmail.com

unread,
Jun 7, 2021, 6:38:14 AM6/7/21
to SWAT-MODFLOW
Hi Seonggyu,
Can you please check the swatmod that I have shared with you, I have following problems with model.
1. Runtime error, model automatically closing after 4 yrs of runtime
2. MODFLOW pumping well package activated and relevant data is imported to MODFLOW well package, but it is not able connect to SWATMOD
3. Stream-aquifer interactions not showing 

Source modflow model is also shared with you in the previous email. 
 
Thank you.

Best Wishes,
Suri

Seonggyu Park

unread,
Jun 11, 2021, 9:33:22 AM6/11/21
to SWAT-MODFLOW
Hi Suri,

I've changed a setting in the MODFLOW model.
1. Changed "SS" to "TR" in the *.dis file.
Capture01.JPG

2. Re-imported the MODFLOW model to your QSWATMOD project
 - MODFLOW inputs should be in the same location as SWAT inputs, not in a separate folder.

I found an issue with a bug that skips MODFLOW wel information. I will fix it during the weekend and let you know how it goes.
Now, you can see SW-GW interaction results from QSWATMOD.
Capture02.JPG


Here is a link to the modified one.

Best,
Seonggyu

sury...@gmail.com

unread,
Jun 16, 2021, 12:36:30 PM6/16/21
to SWAT-MODFLOW

Hi Vahid,
I am just trying to learn SWAT-MODFLOW, i did some trials, one model was successfully ran. Now in the final water balance results, some of component abbreviations not clear to me. Can you please clarify this. pls check the xls attached.  Also, how we can close the complete water balance?

Best Wishes,
Suri

On Wednesday, December 9, 2020 at 8:44:55 AM UTC+5:30 vahi...@gmail.com wrote:
wb_monthly_total.xls

sury...@gmail.com

unread,
Jun 16, 2021, 12:51:21 PM6/16/21
to SWAT-MODFLOW

Hi Seonggyu,
Did you get a chance to check  the problem with well package in QSWATMOD?
Best Wishes,
Suri

rael nyakundi

unread,
Jun 19, 2021, 10:16:24 PM6/19/21
to SWAT-MODFLOW
Hi DR,
Did you fix this issue?
I have well package in my modflow model developed using model muse but when simulating i am getting "please provide a well package to your modflow model first" Kindly guide me how to do that.
Thanks

Reply all
Reply to author
Forward
0 new messages