diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 84c075c..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index 3f0e961..6d4dff9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,48 +1,39 @@ -bmaker/Data/bkf_width/bkf_width.cpg -bmaker/Data/bkf_width/bkf_width.dbf -bmaker/Data/bkf_width/bkf_width.prj -bmaker/Data/bkf_width/bkf_width.qmd -bmaker/Data/bkf_width/bkf_width.shp -bmaker/Data/bkf_width/bkf_width.shx -bmaker/Data/DEM/DEM.tif -bmaker/Data/lakes/lakes.cpg -bmaker/Data/lakes/lakes.dbf -bmaker/Data/lakes/lakes.prj -bmaker/Data/lakes/lakes.qmd -bmaker/Data/lakes/lakes.shp -bmaker/Data/lakes/lakes.shx -bmaker/Data/landuse/landuse_info.csv -bmaker/Data/landuse/landuse.cpg -bmaker/Data/landuse/landuse.dbf -bmaker/Data/landuse/landuse.prj -bmaker/Data/landuse/landuse.qmd -bmaker/Data/landuse/landuse.shp -bmaker/Data/landuse/landuse.shx -bmaker/Data/landuse/veg_info.csv -bmaker/Data/soil/soil_info.csv -bmaker/Data/soil/soil_type.cpg -bmaker/Data/soil/soil_type.dbf -bmaker/Data/soil/soil_type.prj -bmaker/Data/soil/soil_type.qmd -bmaker/Data/soil/soil_type.shp -bmaker/Data/soil/soil_type.shx -bmaker/Data/stations/gauges_station.cpg -bmaker/Data/stations/gauges_station.dbf -bmaker/Data/stations/gauges_station.prj -bmaker/Data/stations/gauges_station.shp -bmaker/Data/stations/gauges_station.shx qraven/__pycache__/qraven.cpython-38.pyc -bmaker/gen_hru.py -.gitignore -.gitignore __pycache__/create_RVH.cpython-38.pyc -qraven/__pycache__/qraven.cpython-38.pyc -qraven/__pycache__/qraven.cpython-38.pyc -qraven/__pycache__/qraven.cpython-38.pyc -qraven/__pycache__/qraven.cpython-38.pyc -qraven/__pycache__/qraven.cpython-38.pyc -qraven/__pycache__/qraven.cpython-38.pyc +qraven/modules/.DS_Store qraven/__pycache__/qraven.cpython-39.pyc qraven/__pycache__/qraven.cpython-39.pyc +qraven/modules/__pycache__/customoutputs.cpython-39.pyc +qraven/modules/__pycache__/hydrologicproc.cpython-39.pyc +qraven/modules/__pycache__/PyRavenR.cpython-39.pyc +qraven/modules/datascrapers/__pycache__/streamflow.cpython-39.pyc +qraven/modules/docker/__pycache__/dockercmd.cpython-39.pyc +qraven/modules/templates/__pycache__/canshield.cpython-39.pyc +qraven/modules/templates/__pycache__/hbvec.cpython-39.pyc +qraven/modules/templates/__pycache__/hmets.cpython-39.pyc +qraven/modules/templates/__pycache__/hymod.cpython-39.pyc +qraven/modules/templates/__pycache__/hypr.cpython-39.pyc +qraven/modules/templates/__pycache__/mohyse.cpython-39.pyc +qraven/modules/templates/__pycache__/ubcwm.cpython-39.pyc +qraven/.DS_Store +qraven/help/.DS_Store qraven/modules/.DS_Store -.gitignore +.vscode/settings.json +qraven/__pycache__/__init__.cpython-38.pyc +qraven/__pycache__/qraven_dialog.cpython-38.pyc +qraven/__pycache__/resources.cpython-38.pyc +qraven/modules/__pycache__/customoutputs.cpython-38.pyc +qraven/modules/__pycache__/hydrologicproc.cpython-38.pyc +qraven/modules/__pycache__/PyRavenR.cpython-38.pyc +qraven/modules/__pycache__/resetgui.cpython-38.pyc +qraven/modules/datascrapers/__pycache__/gisdata.cpython-38.pyc +qraven/modules/datascrapers/__pycache__/streamflow.cpython-38.pyc +qraven/modules/docker/__pycache__/dockercmd.cpython-38.pyc +qraven/modules/templates/__pycache__/gr4j.cpython-38.pyc +qraven/modules/templates/__pycache__/canshield.cpython-38.pyc +qraven/modules/templates/__pycache__/hbvec.cpython-38.pyc +qraven/modules/templates/__pycache__/hmets.cpython-38.pyc +qraven/modules/templates/__pycache__/hymod.cpython-38.pyc +qraven/modules/templates/__pycache__/hypr.cpython-38.pyc +qraven/modules/templates/__pycache__/ubcwm.cpython-38.pyc +qraven/modules/templates/__pycache__/mohyse.cpython-38.pyc diff --git a/qraven/.DS_Store b/qraven/.DS_Store deleted file mode 100644 index f935a6d..0000000 Binary files a/qraven/.DS_Store and /dev/null differ diff --git a/qraven/__pycache__/__init__.cpython-38.pyc b/qraven/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 8a419a6..0000000 Binary files a/qraven/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/qraven/__pycache__/__init__.cpython-39.pyc b/qraven/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 84ac03b..0000000 Binary files a/qraven/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/gr4j.cpython-39.pyc b/qraven/__pycache__/gr4j.cpython-39.pyc deleted file mode 100644 index fc580e1..0000000 Binary files a/qraven/__pycache__/gr4j.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/hbvec.cpython-39.pyc b/qraven/__pycache__/hbvec.cpython-39.pyc deleted file mode 100644 index ddeafcf..0000000 Binary files a/qraven/__pycache__/hbvec.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/hmets.cpython-39.pyc b/qraven/__pycache__/hmets.cpython-39.pyc deleted file mode 100644 index 9af8399..0000000 Binary files a/qraven/__pycache__/hmets.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/qraven.cpython-38.pyc b/qraven/__pycache__/qraven.cpython-38.pyc deleted file mode 100644 index 30495c5..0000000 Binary files a/qraven/__pycache__/qraven.cpython-38.pyc and /dev/null differ diff --git a/qraven/__pycache__/qraven.cpython-39.pyc b/qraven/__pycache__/qraven.cpython-39.pyc deleted file mode 100644 index 5a58669..0000000 Binary files a/qraven/__pycache__/qraven.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/qraven_dialog.cpython-38.pyc b/qraven/__pycache__/qraven_dialog.cpython-38.pyc deleted file mode 100644 index 32f9c32..0000000 Binary files a/qraven/__pycache__/qraven_dialog.cpython-38.pyc and /dev/null differ diff --git a/qraven/__pycache__/qraven_dialog.cpython-39.pyc b/qraven/__pycache__/qraven_dialog.cpython-39.pyc deleted file mode 100644 index cab6d39..0000000 Binary files a/qraven/__pycache__/qraven_dialog.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/qrvn_resetgui.cpython-39.pyc b/qraven/__pycache__/qrvn_resetgui.cpython-39.pyc deleted file mode 100644 index 1ac96e8..0000000 Binary files a/qraven/__pycache__/qrvn_resetgui.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/resetgui.cpython-39.pyc b/qraven/__pycache__/resetgui.cpython-39.pyc deleted file mode 100644 index 9bccacc..0000000 Binary files a/qraven/__pycache__/resetgui.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/resources.cpython-38.pyc b/qraven/__pycache__/resources.cpython-38.pyc deleted file mode 100644 index 5bfb46a..0000000 Binary files a/qraven/__pycache__/resources.cpython-38.pyc and /dev/null differ diff --git a/qraven/__pycache__/resources.cpython-39.pyc b/qraven/__pycache__/resources.cpython-39.pyc deleted file mode 100644 index 3f67241..0000000 Binary files a/qraven/__pycache__/resources.cpython-39.pyc and /dev/null differ diff --git a/qraven/__pycache__/ubcwm.cpython-39.pyc b/qraven/__pycache__/ubcwm.cpython-39.pyc deleted file mode 100644 index 8b1fbda..0000000 Binary files a/qraven/__pycache__/ubcwm.cpython-39.pyc and /dev/null differ diff --git a/qraven/RavenParameters.dat b/qraven/ext_data/RavenParameters.dat similarity index 99% rename from qraven/RavenParameters.dat rename to qraven/ext_data/RavenParameters.dat index eff876b..127a526 100644 --- a/qraven/RavenParameters.dat +++ b/qraven/ext_data/RavenParameters.dat @@ -272,4 +272,4 @@ RESERVOIR_RELAX GLOBAL [0..1] True 0.4 0 1 ASSIMILATION_FACT GLOBAL [0..1] True 1 0 1 ASSIM_UPSTREAM_DECAY GLOBAL [1/km] True 0.01 0 1 ASSIM_TIME_DECAY GLOBAL [1/d] True 0.2 0 1 -RESERVOIR_DEMOND_MULT GLOBAL [0..1] False 0 0 1 +RESERVOIR_DEMOND_MULT GLOBAL [0..1] False 0 0 1 \ No newline at end of file diff --git a/qraven/ext_data/cities.txt b/qraven/ext_data/cities.txt new file mode 100644 index 0000000..5ee16d9 --- /dev/null +++ b/qraven/ext_data/cities.txt @@ -0,0 +1,711 @@ +Acton Vale + +Aguanish + +Amos + +Amqui + +Arundel + +Ascot Corner + +Audet + +Authier + +Baie-Comeau + +Baie-des-Chaloupes + +Baie-d'Hudson + +Baie-Saint-Paul + +Beauceville + +Bécancour + +Bedford + +Belle-Rivière + +Blanc-Sablon + +Boileau + +Boischatel + +Bonaventure + +Bouchette + +Bromont + +Brownsburg-Chatham + +Caniapiscau + +Cap-Chat + +Chambord + +Charlemagne + +Château-Richer + +Chénéville + +Chibougamau + +Chute-Saint-Philippe + +Clermont + +Coaticook + +Compton + +Cookshire-Eaton + +Côte-Nord-du-Golfe-du-Saint-Laurent + +Courcelles + +Cowansville + +Crabtree + +Danville + +Dégelis + +Deschaillons-sur-Saint-Laurent + +Deux-Montagnes + +Dolbeau-Mistassini + +Donnacona + +Drummondville + +Dudswell + +Eastman + +Eeyou Istchee Baie-James + +Elgin + +Entrelacs + +Farnham + +Franklin + +Gaspé + +Gatineau + +Girardville + +Godbout + +Gracefield + +Granby + +Grande-Rivière + +Grande-Vallée + +Grand-Remous + +Grenville-sur-la-Rouge + +Guérin + +Harrington + +Hatley + +Havre-Saint-Pierre + +Hébertville + +Hemmingford + +Hinchinbrooke + +Huberdeau + +Huntingdon + +Inukjuak + +Inverness + +Irlande + +Ivry-sur-le-Lac + +Joliette + +Kamouraska + +Kazabazua + +Kiamika + +Kinnear's Mills + +Kipawa + +La Macaza + +La Minerve + +La Pêche + +La Sarre + +La Tuque + +La Visitation-de-Yamaska + +Labelle + +Lac-Ashuapmushuan + +Lac-au-Brochet + +Lac-aux-Sables + +Lac-Blanc + +Lac-Bouchette + +Lac-Brome + +Lac-Casault + +Lac-des-Écorces + +Lac-des-Seize-Îles + +Lac-Douaire + +Lac-Etchemin + +Lac-Granet + +Lac-Jacques-Cartier + +Lac-Jérôme + +Lac-Mégantic + +Lac-Ministuk + +Lac-Nilgaut + +Lac-Normand + +Lacolle + +Lac-Oscar + +Lac-Pikauba + +Lac-Saint-Paul + +Lac-Simon + +Lac-Supérieur + +Laforce + +L'Ancienne-Lorette + +Laniel + +L'Anse-Saint-Jean + +Lantier + +L'Assomption + +Laval + +Laverlochère-Angliers + +L'Épiphanie + +Les Escoumins + +Les Lacs-du-Témiscamingue + +Lévis + +L'Île-d'Anticosti + +Lingwick + +Lyster + +Macamic + +Maddington Falls + +Mandeville + +Maniwaki + +Mansfield-et-Pontefract + +Marston + +Mascouche + +Matagami + +Matane + +Melbourne + +Mercier + +Mille-Isles + +Mirabel + +Mont-Albert + +Mont-Blanc + +Montcerf-Lytton + +Mont-Laurier + +Montmagny + +Montpellier + +Montréal + +Mont-Tremblant + +Mont-Valin + +Neuville + +New Richmond + +Newport + +Normandin + +North Hatley + +Notre-Dame-des-Neiges + +Notre-Dame-de-Stanbridge + +Notre-Dame-du-Laus + +Nouvelle + +Orford + +Ormstown + +Papineauville + +Parisville + +Passes-Dangereuses + +Péribonka + +Petit-Mécatina + +Petit-Saguenay + +Piedmont + +Pike River + +Pikogan + +Plessisville + +Pohénégamook + +Pointe-Calumet + +Pontiac + +Portage-du-Fort + +Port-Cartier + +Portneuf + +Portneuf-sur-Mer + +Preissac + +Québec + +Rawdon + +Richmond + +Rimouski + +Ripon + +Rivière-à-Pierre + +Rivière-au-Tonnerre + +Rivière-Bleue + +Rivière-Bonaventure + +Rivière-Bonjour + +Rivière-du-Loup + +Rivière-Koksoak + +Rivière-Mistassini + +Rivière-Mouchalagane + +Rivière-Rouge + +Rivière-Saint-Jean + +Roberval + +Routhierville + +Rouyn-Noranda + +Roxton + +Roxton Pond + +Sacré-Coeur + +Saguenay + +Saint-Adolphe-d'Howard + +Saint-Aimé-du-Lac-des-Îles + +Saint-Alban + +Saint-Albert + +Saint-Alexandre-de-Kamouraska + +Saint-Alexis-des-Monts + +Saint-Alphonse + +Saint-Alphonse-de-Granby + +Saint-Anaclet-de-Lessard + +Saint-André-Avellin + +Saint-André-d'Argenteuil + +Saint-Anselme + +Saint-Antoine-de-Tilly + +Saint-Antonin + +Saint-Armand + +Saint-Aubert + +Saint-Augustin-de-Woburn + +Saint-Basile + +Saint-Bernard + +Saint-Calixte + +Saint-Charles-de-Bellechasse + +Saint-Chrysostome + +Saint-Colomban + +Saint-Côme + +Saint-Côme--Linière + +Saint-David + +Saint-Denis-de-Brompton + +Saint-Didace + +Saint-Donat + +Sainte-Adèle + +Sainte-Agathe-des-Monts + +Sainte-Angèle-de-Mérici + +Sainte-Anne-de-la-Pocatière + +Sainte-Anne-des-Lacs + +Sainte-Brigide-d'Iberville + +Sainte-Brigitte-des-Saults + +Sainte-Catherine + +Sainte-Catherine-de-la-Jacques-Cartier + +Sainte-Clotilde + +Sainte-Clotilde-de-Horton + +Sainte-Émélie-de-l'Énergie + +Sainte-Hélène-de-Kamouraska + +Sainte-Hélène-de-Mancebourg + +Sainte-Jeanne-d'Arc + +Sainte-Lucie-des-Laurentides + +Sainte-Madeleine-de-la-Rivière-Madeleine + +Sainte-Marguerite-du-Lac-Masson + +Sainte-Marie + +Sainte-Marie-Salomé + +Sainte-Martine + +Saint-Éphrem-de-Beauce + +Sainte-Praxède + +Sainte-Sophie + +Sainte-Sophie-d'Halifax + +Saint-Esprit + +Sainte-Thérèse-de-la-Gatineau + +Sainte-Ursule + +Saint-Eustache + +Saint-Félicien + +Saint-Félix-de-Valois + +Saint-Frédéric + +Saint-Fulgence + +Saint-Gabriel + +Saint-Gabriel-de-Valcartier + +Saint-Georges + +Saint-Gervais + +Saint-Gilbert + +Saint-Gilles + +Saint-Henri + +Saint-Hippolyte + +Saint-Hugues + +Saint-Hyacinthe + +Saint-Ignace-de-Stanbridge + +Saint-Isidore + +Saint-Jacques-de-Leeds + +Saint-Jean-Baptiste + +Saint-Jean-de-Brébeuf + +Saint-Jean-de-l'Île-d'Orléans + +Saint-Jean-sur-Richelieu + +Saint-Jérôme + +Saint-Joseph-de-Beauce + +Saint-Joseph-de-Coleraine + +Saint-Joseph-de-Kamouraska + +Saint-Jude + +Saint-Just-de-Bretenières + +Saint-Lambert-de-Lauzon + +Saint-Léonard-d'Aston + +Saint-Léonard-de-Portneuf + +Saint-Louis-de-Gonzague + +Saint-Ludger + +Saint-Marc-du-Lac-Long + +Saint-Martin + +Saint-Mathias-sur-Richelieu + +Saint-Mathieu-du-Parc + +Saint-Michel-des-Saints + +Saint-Narcisse-de-Beaurivage + +Saint-Onésime-d'Ixworth + +Saint-Pacôme + +Saint-Patrice-de-Beaurivage + +Saint-Paul + +Saint-Paul-de-l'Île-aux-Noix + +Saint-Paulin + +Saint-Philippe + +Saint-Pie + +Saint-Prime + +Saint-Prosper + +Saint-Raphaël + +Saint-Raymond + +Saint-Roch-de-l'Achigan + +Saints-Anges + +Saint-Stanislas + +Saint-Sylvère + +Saint-Théophile + +Saint-Thomas-Didyme + +Saint-Ubalde + +Saint-Ulric + +Saint-Urbain + +Saint-Valérien-de-Milton + +Saint-Victor + +Scott + +Senneterre + +Sept-Îles + +Shannon + +Shawinigan + +Shefford + +Sherbrooke + +Stanstead + +Stanstead-Est + +Stoke + +Stoneham-et-Tewkesbury + +Stratford + +Taschereau + +Terrebonne + +Tingwick + +Toponyme à venir + +Très-Saint-Sacrement + +Trois-Rives + +Upton + +Val-Brillant + +Valcourt + +Val-des-Monts + +Val-d'Or + +Vallée-Jonction + +Val-Morin + +Victoriaville + +Waltham + +Warden + +Waterloo + +Waterville + +Weedon + +Westbury + +Windsor + +Yamachiche + +Yamaska \ No newline at end of file diff --git a/qraven/ext_data/icons/basinmaker.svg b/qraven/ext_data/icons/basinmaker.svg new file mode 100644 index 0000000..1e2eb76 --- /dev/null +++ b/qraven/ext_data/icons/basinmaker.svg @@ -0,0 +1,68 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + toolbox-repairing + + diff --git a/qraven/ext_data/icons/gis.svg b/qraven/ext_data/icons/gis.svg new file mode 100644 index 0000000..8cf337b --- /dev/null +++ b/qraven/ext_data/icons/gis.svg @@ -0,0 +1,72 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + toolbox-repairing + + + + diff --git a/qraven/ext_data/icons/gridweights.svg b/qraven/ext_data/icons/gridweights.svg new file mode 100644 index 0000000..cd294b0 --- /dev/null +++ b/qraven/ext_data/icons/gridweights.svg @@ -0,0 +1,67 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + toolbox-repairing + + diff --git a/qraven/ext_data/icons/precipitation.svg b/qraven/ext_data/icons/precipitation.svg new file mode 100644 index 0000000..d488e9b --- /dev/null +++ b/qraven/ext_data/icons/precipitation.svg @@ -0,0 +1,70 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + toolbox-repairing + + + + diff --git a/qraven/ext_data/icons/raven.svg b/qraven/ext_data/icons/raven.svg new file mode 100644 index 0000000..ffa4611 --- /dev/null +++ b/qraven/ext_data/icons/raven.svg @@ -0,0 +1,70 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + + toolbox-repairing + + diff --git a/qraven/ext_data/icons/rvifile.svg b/qraven/ext_data/icons/rvifile.svg new file mode 100644 index 0000000..4445cd0 --- /dev/null +++ b/qraven/ext_data/icons/rvifile.svg @@ -0,0 +1,73 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + + toolbox-repairing + + + + diff --git a/qraven/ext_data/icons/settings.svg b/qraven/ext_data/icons/settings.svg new file mode 100644 index 0000000..8b3ff3c --- /dev/null +++ b/qraven/ext_data/icons/settings.svg @@ -0,0 +1,72 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + + toolbox-repairing + + + + diff --git a/qraven/ext_data/icons/streamflow.svg b/qraven/ext_data/icons/streamflow.svg new file mode 100644 index 0000000..1484323 --- /dev/null +++ b/qraven/ext_data/icons/streamflow.svg @@ -0,0 +1,72 @@ + + + + + + image/svg+xml + + toolbox-repairing + + + + + + + + + toolbox-repairing + + + + diff --git a/qraven/ext_data/regions.txt b/qraven/ext_data/regions.txt new file mode 100644 index 0000000..db40cc2 --- /dev/null +++ b/qraven/ext_data/regions.txt @@ -0,0 +1,33 @@ +Abitibi-Témiscamingue + +Bas-Saint-Laurent + +Capitale-Nationale + +Centre-du-Québec + +Chaudière-Appalaches + +Côte-Nord + +Estrie + +Gaspésie--Îles-de-la-Madeleine + +Lanaudière + +Laurentides + +Laval + +Mauricie + +Montérégie + +Montréal + +Nord-du-Québec + +Outaouais + +Saguenay--Lac-Saint-Jean \ No newline at end of file diff --git a/qraven/ext_data/rivers.txt b/qraven/ext_data/rivers.txt new file mode 100644 index 0000000..d2b47af --- /dev/null +++ b/qraven/ext_data/rivers.txt @@ -0,0 +1,787 @@ +Abénaquis, Rivière des + +Abercromby, Rivière + +Abitibi, Lac + +Achigan, Lac de l' + +Achigan, Rivière de l' + +Aguanish, Rivière + +Allard, Rivière + +Anges, Ruisseau des + +Anglais, Rivière aux + +Anglais, Rivière des + +Anistuwach, Rivière + +Archambault, Lac + +Argent, Lac d' + +Arnold, Rivière + +Ashuapmushuan, Rivière + +Aulnaies, Ruisseau des + +Aylmer, Lac + +Baleine, Grande rivière de la + +Baleine, Petite rivière de la + +Baleine, Rivière à la + +Baptiste, Lac + +Barrière, Lac + +Batiscan, Rivière + +Bayonne, Rivière + +Beau Portage, Lac du + +Beaudet, Réservoir + +Beaudet, Ruisseau + +Beauport, Rivière + +Beaurivage, Rivière + +Beaven, Lac + +Bécancour, Rivière + +Bécard, Lac + +Bell, Rivière + +Belle Rivière, La + +Bellefeuille, Rivière + +Berger, Rivière du + +Betsiamites, Rivière + +Birchton, Ruisseau + +Blanc, Lac + +Blanche, Rivière + +Bluets, Rivière aux + +Bonaventure, Rivière + +Bonniebrook, Ruisseau + +Bouchette, Lac + +Bourbon, Rivière + +Bourlamaque, Rivière + +Boutin, Rivière + +Boyer Nord, Rivière + +Boyer Sud, Rivière + +Boyer, Rivière + +Brador, Rivière + +Broadback, Rivière + +Brochets, Rivière aux + +Brome, Lac + +Brompton, Lac + +Brûlé, Lac + +Bullard, Ruisseau + +Bulstrode, Rivière + +Cabano, Rivière + +Canard, Rivière au + +Caniapiscau, Rivière + +Cap Rouge, Rivière du + +Cap-Chat, Rivière + +Capitachouane, Rivière + +Cascapédia, Petite rivière + +Cascapédia, Rivière + +Cassette, Rivière à + +Castor, Ruisseau au + +Champlain, Lac + +Chapleau, Lac + +Châteauguay, Rivière + +Chaudière, Rivière + +Chêne, Petite rivière du + +Chêne, Rivière du + +Chibouet, Rivière + +Chibougamau, Lac + +Chibougamau, Rivière + +Chicoutimi, Rivière + +Coaticook, Rivière + +Commissaires, Lac des + +Cornu, Lac + +Coulonge, Rivière + +Coxipi, Rivière + +Cranberry, Ruisseau + +Croche, Rivière + +Cyriac, Rivière + +Daaquam, Rivière + +Danville, Rivière + +Dany, Rivière + +Dartmouth, Rivière + +Dauphine, Rivière + +David, Rivière + +De Pas, Rivière + +De Pontois, Rivière + +Decoumte, Rivière + +Delorme, Rivière + +Denys, Rivière + +Désert, Rivière + +Deux Montagnes, Lac des + +Diable, Rivière du + +Doncaster, Rivière + +Dorés, Lac aux + +Dumoine, Rivière + +Duvivier, Lac + +Eastmain, Rivière + +Eaton Nord, Rivière + +Eaton, Rivière + +Eau Claire, Rivière à l' + +Eaux Volées, Ruisseau des + +Écho, Lac + +Écorces, Lac des + +Écorces, Rivière aux + +Escalier, Lac + +Escoumins, Rivière des + +Étamamiou, Rivière + +Etchemin, Rivière + +Ewing, Ruisseau + +False, Rivière + +Famine, Rivière + +Fermes, Rivière des + +Feuilles, Rivière aux + +Fouquette, Rivière + +Fourchette, Ruisseau + +Fourchue, Rivière + +Gatineau, Rivière + +Gentilly, Rivière + +George, Rivière + +Giard, Rivière + +Gibeault-Delisle, Ruisseau + +Gipouloux, Rivière + +Godbout, Rivière + +Gordon, Ruisseau + +Gouffre, Rivière du + +Grande Rivière, La + +Grande Vallée, Rivière de la + +Gunn, Ruisseau + +Ha! Ha!, Rivière + +Hamelin, Rivière + +Harricana, Rivière + +Henri, Bras d' + +Highfall, Ruisseau + +Huile, Rivière à l' + +Hurons, Rivière des + +Îles Brûlées, Rivière des + +Îles, Lac des + +Innuksuac, Rivière + +Iroquois, Rivière aux + +Jack, Lac à + +Jacques-Cartier, Rivière + +Jaune, Rivière + +Jim, Lac à + +Jupiter, Rivière + +Kamouraska, Rivière + +Kanaaupscow, Rivière + +Kazabazua, Rivière + +Kee, Ruisseau + +Kénogami, Lac + +Kiamika, Réservoir + +Kiamika, Rivière + +Kinojévis, Rivière + +Kipawa, Lac + +Kipawa, Rivière + +Klotz, Lac + +Kogaluc, Rivière + +La Chevrotière, Rivière + +La Goudalie, Rivière + +La Sarre, Rivière + +Lac la Pêche, Décharge du + +L'Acadie, Rivière + +Lacolle, Rivière + +Laforge, Rivière + +L'Assomption, Rivière + +Lepellé, Rivière + +Lièvre, Rivière du + +Long, Lac + +Lorette, Rivière + +Louis, Lac à + +Louise, Lac + +Loup, Rivière du + +Loups Marins, Lac des + +Loutre, Ruisseau de la + +Lovering, Lac + +Ludger, Lac + +Lyster, Lac + +Macamic, Lac + +MacDonald, Grand lac + +Madawaska, Rivière + +Madeleine, Rivière + +Maganasipi, Rivière + +Magpie, Lac + +Magpie, Rivière + +Malbaie, Rivière + +Manitou, Lac + +Manouane, Rivière + +Marguerite, Rivière + +Marois, Lac + +Mars, Rivière à + +Marte, Rivière à la + +Mascouche, Rivière + +Maskinongé, Lac + +Maskinongé, Rivière + +Massawippi, Lac + +Massawippi, Rivière + +Masson, Lac + +Mastigouche, Rivière + +Matamec, Rivière + +Matane, Lac + +Matane, Rivière + +Matapédia, Lac + +Matapédia, Rivière + +Matawin, Rivière + +Mégantic, Lac + +Mégiscane, Rivière + +Mékinac, Rivière + +Mélèzes, Rivière aux + +Métabetchouane, Rivière + +Mille Îles, Rivière des + +Minto, Lac + +Mistassibi, Rivière + +Mistassini, Lac + +Mistassini, Rivière + +Mitchinamecus, Réservoir + +Mitchinamecus, Rivière + +Mitis, Rivière + +Moisie, Rivière + +Monroe, Lac + +Montagne Noire, Lac de la + +Montmorency, Rivière + +Morency, Rivière + +Morin, Lac + +Morpions, Ruisseau + +Moulin, Rivière du + +Nadeau, Rivière + +Nastapoka, Rivière + +Natashquan, Rivière + +Neiges, Lac des + +Neigette, Petite rivière + +Neigette, Rivière + +Neilson, Rivière + +Nelson, Rivière + +Nemiscau, Lac + +Nichicun, Lac + +Nicolet Sud-Ouest, Rivière + +Nicolet, Rivière + +Noire, Rivière + +Nord, Bras du + +Nord, Rivière du + +Norton, Ruisseau + +Nottaway, Rivière + +Nouvelle, Rivière + +Ontaritzi, Rivière + +Opinaca, Rivière + +Orford, Lac + +Osgood, Rivière + +Ouareau, Lac + +Ouareau, Rivière + +Ouasiemsca, Rivière + +Ouelle, Rivière + +Ouest, Rivière de l' + +Ouiatchouan, Rivière + +Ouiqui, Lac + +Ours, Ruisseau à l' + +Outaouais, Rivière des + +Outardes Est, Rivière aux + +Palmer, Rivière + +Papineau, Lac + +Pat, Rivière à + +Payne, Lac + +Pêche, Rivière la + +Pékans, Rivière aux + +Péribonka, Petite rivière + +Petit Mécatina, Rivière du + +Petit Saguenay, Rivière + +Petite Nation, Rivière de la + +Picanoc, Rivière + +Pikauba, Rivière + +Piles, Lac des + +Pohénégamook, Lac + +Point du Jour, Ruisseau du + +Poisson Blanc, Lac du + +Pommes, Rivière aux + +Pontax, Rivière + +Portage, Ruisseau du + +Portneuf, Rivière + +Pozer, Rivière + +Prairies, Rivière des + +Qalluviartuuq, Lac + +Quilliams, Ruisseau + +Quinze, Lac des + +Qurlutuq, Rivière + +Rapides, Rivière des + +Rapin, ruisseau + +Rawdon, Lac + +Renard, Rivière au + +René-Lévesque, Rivière + +Renne, Rivière le + +Richelieu, Rivière + +Rimouski, Rivière + +Riverin, Rivière + +Robertson, Lac + +Roche, Rivière de la + +Rocheux, Bras + +Roggan, Rivière + +Romaine, Rivière + +Rond, Lac + +Rouge, Rivière + +Rouge, Ruisseau + +Runnels, Ruisseau + +Rupert, Rivière + +Sables, Lac aux + +Sables, Lac des + +Sables, Rivière aux + +Sacacomie, Lac + +Sacacomie, Rivière + +Saint-Alexis, Lac + +Saint-Augustin, Rivière + +Saint-Charles, Rivière + +Sainte-Anne, Rivière + +Sainte-Marguerite Nord-Est, Rivière + +Saint-Esprit, Rivière + +Saint-François, Grand lac + +Saint-François, Rivière + +Saint-Germain, Rivière + +Saint-Jacques, Rivière + +Saint-Jean, Lac + +Saint-Jean, Rivière + +Saint-Joseph, Lac + +Saint-Louis, Rivière + +Saint-Louis, Ruisseau + +Saint-Maurice, Rivière + +Saint-Nicolas, Bras + +Saint-Paul, Rivière + +Saint-Pierre, Ruisseau + +Saint-Régis, Rivière + +Saint-Victor, Bras + +Sakami, Rivière + +Salvail, Rivière + +Samson, Rivière + +Sault à la Puce, Rivière du + +Saults, Rivière des + +Saumon, Rivière au + +Saumons, Rivière aux + +Savane, Lac de la + +Schryer, Lac + +Schryer, Ruisseau + +Seize Îles, Lac des + +Serpent, Rivière au + +Shawinigan, Rivière + +Simard, Lac + +Simon, Lac + +Simon, Rivière à + +Simoncouche, Rivière + +Souris, Lac des + +Stoke, Rivière + +Stukely, Lac + +Sud, Rivière du + +Sud-Ouest, Rivière du + +Suffolk, Ruisseau + +Swampy Bay, Rivière + +Tantaré, Lac + +Taschereau, Lac + +Témiscamie, Rivière + +Théodore, Lac + +Ticouapé, Rivière + +Tomifobia, Rivière + +Tonnerre, Rivière au + +Tourilli, Rivière + +Trente et Un Milles, Lac des + +Trib.45D.23M.31S.-72D.40M.07S. + +Trib.46D.29M.02S.-73D.13M.54S. + +Trib.46D.58M.15S.-71D.39M.29S. + +Trib.49D.12M.59S.-73D.39M.28S. + +Trois Lacs, Les + +Trois Pistoles, Rivière des + +Trois Saumons, Lac + +Trout, Rivière + +Truite, Étang à la + +Truite, Rivière à la + +Turgeon, Rivière + +Vacher, Ruisseau + +Valin, Rivière + +Valois, Lac + +Veilleux, Rivière + +Vermillon, Rivière + +Victoria, Grand lac + +Villebon, Lac + +Walbridge, Ruisseau + +Waswanipi, Rivière + +Waterloo, Lac + +Watopeka, Rivière + +Yamaska Nord, Rivière + +Yamaska Sud-Est, Rivière + +Yamaska, Rivière + +York, Rivière \ No newline at end of file diff --git a/qraven/file b/qraven/file deleted file mode 100644 index 8b13789..0000000 --- a/qraven/file +++ /dev/null @@ -1 +0,0 @@ - diff --git a/qraven/help/source/contribute.rst b/qraven/help/source/contribute.rst index 98b18fd..6887732 100644 --- a/qraven/help/source/contribute.rst +++ b/qraven/help/source/contribute.rst @@ -11,8 +11,8 @@ If you find any possible bugs, errors, typos, please open an issue on `GitHub `_ or a `discussion `_. diff --git a/qraven/help/source/images/gis_ui.png b/qraven/help/source/images/gis_ui.png new file mode 100644 index 0000000..eaf31a1 Binary files /dev/null and b/qraven/help/source/images/gis_ui.png differ diff --git a/qraven/help/source/images/hydroproc_ui.png b/qraven/help/source/images/hydroproc_ui.png new file mode 100644 index 0000000..82d5a4f Binary files /dev/null and b/qraven/help/source/images/hydroproc_ui.png differ diff --git a/qraven/help/source/images/modelinfo_ui.png b/qraven/help/source/images/modelinfo_ui.png new file mode 100644 index 0000000..99839eb Binary files /dev/null and b/qraven/help/source/images/modelinfo_ui.png differ diff --git a/qraven/help/source/images/qgs_pluginmanager_install.png b/qraven/help/source/images/qgs_pluginmanager_install.png new file mode 100644 index 0000000..e903ed5 Binary files /dev/null and b/qraven/help/source/images/qgs_pluginmanager_install.png differ diff --git a/qraven/help/source/images/qgs_pluginmanager_repo.png b/qraven/help/source/images/qgs_pluginmanager_repo.png new file mode 100644 index 0000000..f726c6a Binary files /dev/null and b/qraven/help/source/images/qgs_pluginmanager_repo.png differ diff --git a/qraven/help/source/images/qgs_pluginmanager_upgrade.png b/qraven/help/source/images/qgs_pluginmanager_upgrade.png new file mode 100644 index 0000000..9ace5ec Binary files /dev/null and b/qraven/help/source/images/qgs_pluginmanager_upgrade.png differ diff --git a/qraven/help/source/images/settings_ui.png b/qraven/help/source/images/settings_ui.png new file mode 100644 index 0000000..6e45b97 Binary files /dev/null and b/qraven/help/source/images/settings_ui.png differ diff --git a/qraven/help/source/images/watersurvey_ui.png b/qraven/help/source/images/watersurvey_ui.png new file mode 100644 index 0000000..7558dd1 Binary files /dev/null and b/qraven/help/source/images/watersurvey_ui.png differ diff --git a/qraven/help/source/index.rst b/qraven/help/source/index.rst index a01cb58..965f0fe 100644 --- a/qraven/help/source/index.rst +++ b/qraven/help/source/index.rst @@ -6,7 +6,7 @@ Welcome to QRaven's documentation! ============================================ -You will find all the information about QRaven, from installing it to contributing to its development. +You will find all the information about QRaven, from its installation to contributing to its development. If you find any errors or typos, please `report them `_. diff --git a/qraven/help/source/installation.rst b/qraven/help/source/installation.rst index 11d6e07..dada6e9 100644 --- a/qraven/help/source/installation.rst +++ b/qraven/help/source/installation.rst @@ -10,11 +10,15 @@ To use QRaven, first install a recent version of QGIS (3.20 and above): `https://qgis.org/en/site/forusers/download.html `_ -Some features, such as the BasinMaker tools and the GridWeight Generator, require Docker to be installed. If you are not planning on using those features, you can skip this step. Otherwise, you can get Docker here: -`https://docs.docker.com/get-docker `_ +Some features, such as the BasinMaker tools and the GridWeight Generator, require a containerization software to be installed. If you are not planning on using those features, you can skip this step. +Otherwise, you can pick between Podman and Docker. + +Get Podman : `https://podman.io/getting-started/installation `_ + +Get Docker : `https://docs.docker.com/get-docker `_ .. warning:: - Linux users must run Docker as a non root user. This can be done with the following command: + Linux users who choose Docker must run it as a non root user. This can be done with the following command: .. code-block:: console @@ -26,14 +30,44 @@ Some features, such as the BasinMaker tools and the GridWeight Generator, requir Plugin installation ------------------- -Now that QGIS is installed, simply download the latest release of QRaven here: + +Method 1 (recommended) +^^^^^^^^^^^^^^^^^^^^^^ +Open QGIS and go to the "Plugins" menu. Click on "Manage and Install Plugins". + +.. image:: https://user-images.githubusercontent.com/98601298/170998843-1fa7c283-e15b-4dce-a684-59e16a5c71d4.png + :width: 400 + +Click on the "Settings" tab and click on the "Add" button to add a new plugin repository. + +In the window that just opened, enter a name, such as "QRaven", enter the link below in the URL field and leave the remaining options to their defaults: + +`https://scriptbash.github.io/plugins.xml `_ + +.. figure:: ./images/qgs_pluginmanager_repo.png + :width: 600 + +After connecting to QRaven's repository, click on the "All" menu and search for QRaven. Click on QRaven and click on "Install". + +.. figure:: ./images/qgs_pluginmanager_install.png + :width: 600 + +To update QRaven, simply head back to the plugins manager, search for QRaven and click on "Upgrade Plugin". + +.. figure:: ./images/qgs_pluginmanager_upgrade.png + :width: 600 + + +Method 2 (manual) +^^^^^^^^^^^^^^^^^ +Download the latest release of QRaven here: `https://github.com/Scriptbash/QRaven/releases/latest/download/qraven.zip `_ Alternatively, you can view all of QRaven versions here : `https://github.com/Scriptbash/QRaven/releases `_ -Next, open QGIS and go to the "Plugins" menu. Click on "Manage and Install Plugins" +Next, open QGIS and go to the "Plugins" menu. Click on "Manage and Install Plugins". .. image:: https://user-images.githubusercontent.com/98601298/170998843-1fa7c283-e15b-4dce-a684-59e16a5c71d4.png :width: 400 @@ -43,5 +77,7 @@ Finally, click on "Install from ZIP", select the downloaded qraven.zip file and .. image:: https://user-images.githubusercontent.com/98601298/170999288-1d8db5dc-5709-4139-8aff-412dc76eb1c2.png :width: 600 +To update QRaven, you will need to download the latest .zip file and repeat the same steps as above. + .. note:: - The plugin will look for an update each time QGIS is started. If it finds one, you will have a small notification at the bottom of the plugin window. Simply follow the previous steps to install the new update. + The plugin will look for an update each time QGIS is started. If it finds one, you will have a notification in the notification bar and inside the "Settings" menu of QRaven. \ No newline at end of file diff --git a/qraven/help/source/usage.rst b/qraven/help/source/usage.rst index 71eb70f..488297b 100644 --- a/qraven/help/source/usage.rst +++ b/qraven/help/source/usage.rst @@ -9,28 +9,69 @@ Open QRaven .. |qrvn_ico| image:: https://github.com/Scriptbash/QRaven/blob/main/qraven/icon.png?raw=true :width: 20 -Click on the QRaven icon in your toolbar |qrvn_ico| or go in the "Plugins" menu, select the QRaven option and click on "Generate Raven input files" +Click on the QRaven icon |qrvn_ico| in your toolbar or go in the "Plugins" menu, select the QRaven option and click on "Generate Raven input files" .. image:: https://user-images.githubusercontent.com/98601298/170999781-22514c96-7611-424a-b946-69fd465c5181.png :width: 600 -You will have four main tabs +You will have seven main menus * :ref:`Raven RVI` * :ref:`BasinMaker RVH` * :ref:`GridWeights` + * :ref:`Streamflow` + * :ref:`GIS` * :ref:`Run Model` + * :ref:`Settings` .. _createRVI: Create a RVI file ----------------- -*To-do +QRaven all started with this feature in mind. This tab can be used to create a rvi file from scratch or from a template. +The templates available are UBCWM, HBV-EC, HBV-Light, GR4J, Canadian Shield, +MOHYSE, HMETS, HYPR, HYMOD and AWBM. Those models structures were taken directly from the Raven official documentation. + +This section of the plugin is pretty straight forward to use. Check/uncheck/ options, select entries in drop down lists, etc. +When ready, click on the "Write" button to write the rvi file. Otherwise, you can click on "Reset" to revert the options back to their default values. + +The parameters are separated in different sections. You can find an overview of the options below; + +- Model info + - You can find templates buttons. Simply click on the one needed and the interface will load its configuration. + - Basic information like the name of the model, the start/end date, time step, etc. +- Sim. parameters + - Simulation parameters such as the catchment route, the routing method, evaporation, etc. +- Hydro. processes + - A table that allows to set up the hydrologic processes. + - Click on "Add process" to add a new row or "Remove selected process" to remove the selected row. + - After selecting a process, the available algorithms for that process will be inside the algorithm drop down list. The from and to + compartments drop down list will contain the available compartments for the select process and algorithm. +- Transport cmd + - This work the same way as the hydrologic processes, but for the transport commands. +- Optional I/O + - All kind of optional options like CreateRVPTemplate, evaluation metrics, debug mode, etc. +- Custom output + - This is similar to the hydrologic processes table, but for custom outputs. + + +.. figure:: ./images/modelinfo_ui.png + :width: 600 + + The model info section. + +.. figure:: ./images/hydroproc_ui.png + :width: 800 + + The hydrologic process table. .. _createRVH: Create a RVH file ----------------- +.. warning:: + The Docker daemon must be running to use this feature. Podman users don't need to worry, as Podman is daemonless. + *To-do .. _gridweights: @@ -38,7 +79,7 @@ Create a RVH file Associate a NetCDF grid to the HRUs ----------------------------------- .. warning:: - The Docker daemon must be running to use this feature. + The Docker daemon must be running to use this feature. Podman users don't need to worry, as Podman is daemonless. 1. **NetCDF file** : The NetCDF file to process (inluding the file extension). 2. **Shapefile attribute** (Optional) : Only needed if the Netcdf file is a shapefile. It is the attribute containing the numbering of the subbasins. @@ -55,6 +96,55 @@ Associate a NetCDF grid to the HRUs Example of the gridweights generator interface. +.. _datascrapers: + +Download streamflow data +------------------------ +QRaven can fetch hydrometric data from two providers at this time, which are the +direction principale des prévisions hydriques et de la cartographie (DPPHC) and the Water office. Not only can it fetch data automatically, +it can also generate rvt files from the data. Only flow data is supported, level data is unsupported. + +Both data scrapers work the same way, but their search criterias differ a little bit. This documentation will only cover the Water office scraper. + +- Search a station + 1. Select either "Station name" or "Province". + 2. If "Station name" is selected, type in the full or patial name of the station. If "Province" is selected, select a province in the drop down list. + 3. Use the "Regulation" and "Station status" drop down lists to refine your search if needed. + 4. Click on "Search". + 5. Results will show up in the text area above the "Search" button. + + .. note:: + The station ID is always the first information in the search results. Simply copy/paste an ID into the "Station ID" field in the download section. + + +- Download hydrometric data + 1. In the "Station ID" field, type in the hydrometric station ID from which the data will be downloaded. + 2. In the "Output file" field, select a directory and name for the output file. The extension will always be ".rvt". + 3. Click the "Download" button. + +If you have already downloaded data from one of the two providers, use the following option. + +- Process a local file + 1. In the "Input file" field, select the file you want to process. + 2. In the "Output file" field, select a directory and a name for the rvt file. + 3. Click on the "Process" button. + +.. figure:: ./images/watersurvey_ui.png + :width: 600 + + Example of the Water office UI + +.. _gis: + +Download GIS data +----------------- +To write. + +.. figure:: ./images/gis_ui.png + :width: 600 + + Example of the GIS UI + .. _runrvn: Run a Raven model @@ -74,7 +164,7 @@ If an error occurs and they are not filled automatically, please submit a `bug r .. figure:: https://user-images.githubusercontent.com/98601298/188149995-0dbed886-7906-412a-b798-09bae286959e.png :width: 600 - Example of a the Run Model interface. + Example of the Run Model interface. Draw the hydrograph ------------------- @@ -102,3 +192,29 @@ In order to use this feature, a few steps are required. .. note:: This feature needs more testing and could have many oversights. To help improve it, please submit any problems you encounter by opening a `new issue `_. If possible, also send your Raven model so the issue can be easily reproduced. + +.. _settings: + +Settings +-------- +The Settings menu allows some slight customization of QRaven for the moment. More settings may come later on. + +As per now, you can select which containerization software and which image you want to use. You can also +select a side menu style. + +**Containerization software**: By default, Docker is selected, but if you want to use +Podman, simply select the Podman option in the drop down list. + +**Image**: This option lets you pick between the regular container image and the ARM based image. By default, MacOS +will be running the ARM based image. If your MacBook is Intel based, switch to the regular image. Linux and Windows both +default on the regular image. + +**Menu bar style**: Allows you to choose between the default menu (icons with text) or a collapsed menu (icons only). + +.. warning:: + After making changes to the settings, do not forget to click on the "Save" button. Otherwise, your changes will be lost after closing QGIS. + +.. figure:: ./images/settings_ui.png + :width: 600 + + The settings menu as of version 2.3.0 \ No newline at end of file diff --git a/qraven/modules/.DS_Store b/qraven/modules/.DS_Store deleted file mode 100644 index 92b24fe..0000000 Binary files a/qraven/modules/.DS_Store and /dev/null differ diff --git a/qraven/modules/__pycache__/resetgui.cpython-39.pyc b/qraven/modules/__pycache__/resetgui.cpython-39.pyc deleted file mode 100644 index 6eb16d6..0000000 Binary files a/qraven/modules/__pycache__/resetgui.cpython-39.pyc and /dev/null differ diff --git a/qraven/modules/customoutputs.py b/qraven/modules/customoutputs.py new file mode 100644 index 0000000..adbb17b --- /dev/null +++ b/qraven/modules/customoutputs.py @@ -0,0 +1,127 @@ +from qgis.PyQt.QtWidgets import * + +def addoutput(self): + + table = self.dlg.table_customoutputs #Get the custom outputs table + currentRow = table.rowCount() #Get the number of rows the table has + table.insertRow(currentRow) #Inserts a new row below the last row + combo_time = QComboBox() + combo_stat = QComboBox() + combo_eval = QComboBox() + combo_option = QComboBox() + + combo_variable1 = QComboBox() + combo_variable1.setEditable(True) + combo_variable2 = QComboBox() + combo_variable2.setEditable(True) + combo_variable2.setEnabled(False) + + spin_min = QDoubleSpinBox() + spin_max = QDoubleSpinBox() + spin_bin = QDoubleSpinBox() + + txt_filename = QLineEdit() + + spin_min.setEnabled(False) + spin_bin.setEnabled(False) + spin_max.setEnabled(False) + #spin_min.setDecimals(1) + + + timeperiod = ['DAILY','MONTHLY','YEARLY','WATER_YEARLY','CONTINUOUS'] + statistic = ['AVERAGE','MINIMUM','MAXIMUM','RANGE','MEDIAN','CUMULSUM','QUARTILES','HISTOGRAM'] + evaluation = ['BY_BASIN','BY_HRU','BY_HRU_GROUP','BY_SB_GROUP','ENTIRE_WATERSHED'] + variable = ['','SURFACE_WATER','ATMOSPHERE','ATMOS_PRECIP','PONDED_WATER','GROUNDWATER','CANOPY','CANOPY_SNOW','SNOW', + 'SNOW_LIQ','GLACIER','GLACIER_ICE','CONVOLUTION','SNOW_TEMP','COLD_CONTENT','SOIL_TEMP','CANOPY_TEMP', + 'SURFACE_WATER_TEMP','SNOW_DEPTH','PERMAFROST_DEPTH','SNOW_COVER','SNOW_AGE','SNOW_ALBEDO','CUM_INFIL','CUM_SNOWMELT', + 'CONSTITUENT','PRECIP','SNOW_FRAC','SNOWFALL','RAINFALL','RECHARGE','TEMP_AVE','WIND_VEL','PET','OW_PET','POTENTIAL_MELT', + ] + variable.sort() + option = ['','From:','To:','Between:'] + + combo_time.addItems(timeperiod) + combo_stat.addItems(statistic) + combo_eval.addItems(evaluation) + combo_option.addItems(option) + combo_variable1.addItems(variable) + combo_variable2.addItems(variable) + + table.setCellWidget(currentRow, 0, combo_time) #Sets the new combobox in the first column and in the new row + table.setCellWidget(currentRow, 1, combo_stat) + table.setCellWidget(currentRow, 2, spin_min) + table.setCellWidget(currentRow, 3, spin_max) + table.setCellWidget(currentRow, 4, spin_bin) + table.setCellWidget(currentRow, 5, combo_option) + table.setCellWidget(currentRow, 6, combo_variable1) + table.setCellWidget(currentRow, 7, combo_variable2) + table.setCellWidget(currentRow, 8, combo_eval) + table.setCellWidget(currentRow, 9, txt_filename) + + table.resizeColumnsToContents() #Resizes the width of the column automatically + + combo_stat.currentIndexChanged.connect(lambda:toggleHistogram(self,currentRow)) + combo_option.currentIndexChanged.connect(lambda:toggleVariable(self,currentRow)) + +def removeoutput(self): + table = self.dlg.table_customoutputs + selectedRow = table.currentRow() + table.removeRow(selectedRow) + + +def toggleHistogram(self,row): + table = self.dlg.table_customoutputs + combo_stat = table.cellWidget(row,1) + spin_min = table.cellWidget(row,2) + spin_max = table.cellWidget(row,3) + spin_bin = table.cellWidget(row,4) + + if combo_stat.currentText() == 'HISTOGRAM': + spin_min.setEnabled(True) + spin_max.setEnabled(True) + spin_bin.setEnabled(True) + else: + spin_min.setEnabled(False) + spin_max.setEnabled(False) + spin_bin.setEnabled(False) + +def toggleVariable(self,row): + table = self.dlg.table_customoutputs + combo_option = table.cellWidget(row,5) + combo_variable2 = table.cellWidget(row,7) + + if combo_option.currentText() == 'Between:': + combo_variable2.setEnabled(True) + else: + combo_variable2.setEnabled(False) + +def getOutputs(self): + + table = self.dlg.table_customoutputs + rows = table.rowCount() + cols = table.columnCount() + outputs = [] + for row in range(rows): + tmpoutput = [] + for col in range(cols): + currentWidget = table.cellWidget(row,col) + if isinstance(currentWidget, QComboBox): + if currentWidget.isEnabled(): + if col == 7: + tmpoutput.append('.And. ' + currentWidget.currentText()) + else: + tmpoutput.append(currentWidget.currentText()) + else: + tmpoutput.append('') + + elif isinstance(currentWidget, QDoubleSpinBox): + if currentWidget.isEnabled(): + tmpoutput.append("{:.1f}".format(currentWidget.value())) + else: + tmpoutput.append('') + elif isinstance(currentWidget, QLineEdit): + if currentWidget.text() !='': + tmpoutput.append(currentWidget.text()) + else: + tmpoutput.append('') + outputs.append(tmpoutput) + return outputs \ No newline at end of file diff --git a/qraven/modules/datascrapers/gisdata.py b/qraven/modules/datascrapers/gisdata.py new file mode 100644 index 0000000..302d349 --- /dev/null +++ b/qraven/modules/datascrapers/gisdata.py @@ -0,0 +1,244 @@ +import urllib.request, os, zipfile, tarfile, shutil, processing +from PyQt5.QtWidgets import * +from qgis.core import Qgis, QgsVectorLayer, QgsRasterLayer,QgsCoordinateReferenceSystem,QgsProject,QgsProcessingFeedback + +class gisScraper: + + def dem(self,output): + url = 'https://data.hydrosheds.org/file/hydrosheds-v1-con/na_con_3s.zip' + self.dlg.lbl_progressbar.setText('Downloading DEM') + output+='/dem.zip' + sendRequest(self,url,output) + self.dlg.lbl_progressbar.setText('Extracting...') + extractarchives(output) + + def flowdirection(self, output): + url = 'https://data.hydrosheds.org/file/hydrosheds-v1-dir/hyd_na_dir_15s.zip' + self.dlg.lbl_progressbar.setText('Downloading flow direction') + output+='/flowdir.zip' + sendRequest(self, url, output) + self.dlg.lbl_progressbar.setText('Extracting...') + extractarchives(output) + + def lakes(self,output): + url = 'https://data.hydrosheds.org/file/hydrolakes/HydroLAKES_polys_v10_shp.zip' + self.dlg.lbl_progressbar.setText('Downloading lakes') + output+='/lakes.zip' + sendRequest(self,url,output) + self.dlg.lbl_progressbar.setText('Extracting...') + extractarchives(output) + + def bankfull(self,output): + url = 'https://zenodo.org/record/61758/files/hydrosheds_wqd.tgz?download=1' + self.dlg.lbl_progressbar.setText('Downloading bankfull width') + output+='/bankfull.tgz' + sendRequest(self,url,output) + self.dlg.lbl_progressbar.setText('Extracting...') + extractarchives(output) + + def landuse(self,output): + url = 'https://datacube-prod-data-public.s3.ca-central-1.amazonaws.com/store/land/landcover/landcover-2020-classification.tif' + self.dlg.lbl_progressbar.setText('Downloading landuse cover') + output+='/landuse.tif' + sendRequest(self,url,output) + + def soil(self, output): + url = 'https://sis.agr.gc.ca/cansis/nsdb/slc/v2.2/slc_v2r2_canada.zip' + self.dlg.lbl_progressbar.setText('Downloading soil layer') + output+='/soil.zip' + sendRequest(self,url,output) + self.dlg.lbl_progressbar.setText('Extracting...') + extractarchives(output) + + # output = os.path.dirname(output)+'/soil.dbf' + # url = 'https://sis.agr.gc.ca/soildata/canada/soil_name_canada_v2r20140529.dbf' + # self.dlg.lbl_progressbar.setText('Downloading soil attribute table') + # sendRequest(self,url,output) + + def cliplayer(self, overlay, inputlayer): + global progressbar + progressbar =self.dlg.progress_gisprocess + filename, extension = os.path.splitext(inputlayer) + filename = os.path.basename(filename) + outputpath = os.path.dirname(inputlayer) + + f = QgsProcessingFeedback() + f.progressChanged.connect(qgisprogressbar) + + if filename == 'HydroLAKES_polys_v10': + outfilename = 'qrvn_lakes.shp' + elif filename == 'nariv': + outfilename = 'qrvn_bankfull.shp' + elif filename == 'slc_v2r2_canada': + outfilename = 'qrvn_soiltmp.shp' + elif filename == 'na_con_3s': + outfilename = 'qrvn_DEM.tif' + elif filename == 'hyd_na_dir_15s': + outfilename = 'qrvn_flowdir.tif' + else: + outfilename = 'tmp_landuse.tif' + + if filename !='landuse' and filename != 'slc_v2r2_canada': + makefolders(outputpath+"/results") + output = outputpath+'/results/'+outfilename + else: + output = outputpath+'/'+outfilename + + if extension == '.tif': #input layer is a raster + if filename !='landuse': + processing.runAndLoadResults("gdal:cliprasterbymasklayer", + {'INPUT':inputlayer, + 'MASK':overlay, + 'SOURCE_CRS':None, + 'TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:4326'), + 'TARGET_EXTENT':None,'NODATA':None,'ALPHA_BAND':False,'CROP_TO_CUTLINE':True, + 'KEEP_RESOLUTION':False,'SET_RESOLUTION':False,'X_RESOLUTION':None,'Y_RESOLUTION':None, + 'MULTITHREADING':True,'OPTIONS':'','DATA_TYPE':0,'EXTRA':'', + 'OUTPUT':output + },feedback=f) + else: + processing.run("gdal:cliprasterbymasklayer", + {'INPUT':inputlayer, + 'MASK':overlay, + 'SOURCE_CRS':None, + 'TARGET_CRS':QgsCoordinateReferenceSystem('EPSG:4326'), + 'TARGET_EXTENT':None,'NODATA':None,'ALPHA_BAND':False,'CROP_TO_CUTLINE':True, + 'KEEP_RESOLUTION':False,'SET_RESOLUTION':False,'X_RESOLUTION':None,'Y_RESOLUTION':None, + 'MULTITHREADING':True,'OPTIONS':'','DATA_TYPE':0,'EXTRA':'', + 'OUTPUT':output + },feedback=f) + + else: #input layer is a shapefile + if filename !='slc_v2r2_canada': + processing.runAndLoadResults("native:clip", + {'INPUT':inputlayer, + 'OVERLAY':overlay, + 'OUTPUT':output + },feedback=f) + else: + processing.run("native:clip", + {'INPUT':inputlayer, + 'OVERLAY':overlay, + 'OUTPUT':output + },feedback=f) + + + def joinattributes(self,inputlayer,table,field1,field2,fieldscopy): + output = self.dlg.file_processsoil.filePath() + makefolders(os.path.dirname(output)+"/results") + output = os.path.dirname(output)+'/results/qrvn_soil.shp' + + processing.runAndLoadResults("native:joinattributestable", + {'INPUT':inputlayer, + 'FIELD':field1, + 'INPUT_2':table, + 'FIELD_2':field2, + 'FIELDS_TO_COPY':[fieldscopy], + 'METHOD':1,'DISCARD_NONMATCHING':False,'PREFIX':'', + 'OUTPUT':output}) + + + def polygonize(self,inputlayer): + global progressbar + progressbar =self.dlg.progress_gisprocess + f = QgsProcessingFeedback() + f.progressChanged.connect(qgisprogressbar) + reclassified = processing.run("native:reclassifybytable", + {'INPUT_RASTER':inputlayer, + 'RASTER_BAND':1, + 'TABLE':['20','99999','0'], + 'NO_DATA':0,'RANGE_BOUNDARIES':1, + 'NODATA_FOR_MISSING':False,'DATA_TYPE':5, + 'OUTPUT':'TEMPORARY_OUTPUT'},feedback=f) + layer = reclassified['OUTPUT'] + + polygons = processing.run("gdal:polygonize", + {'INPUT':layer, + 'BAND':1, + 'FIELD':'DN', + 'EIGHT_CONNECTEDNESS':False,'EXTRA':'', + 'OUTPUT':'TEMPORARY_OUTPUT'},feedback=f) + layer = polygons['OUTPUT'] + + output = self.dlg.file_processlanduse.filePath() + makefolders(os.path.dirname(output)+"/results") + output = os.path.dirname(output)+'/results/qrvn_landuse.tif' + processing.runAndLoadResults("native:fieldcalculator", + {'INPUT':layer, + 'FIELD_NAME':'LAND_USE_C', + 'FIELD_TYPE':2,'FIELD_LENGTH':222,'FIELD_PRECISION':0, + 'FORMULA':'if("DN"=1,\'FOREST\',if("DN"=2,\'FOREST\',if("DN"=5,\'FOREST\',if("DN"=6,\'FOREST\',if("DN"=8,\'GRASSLAND\',if("DN"=10,\'GRASSLAND\',if("DN"=11,\'GRASSLAND\',if("DN"=12,\'GRASSLAND\',if("DN"=13,\'OPEN\',if("DN"=14,\'WETLAND\',if("DN"=15,\'AGRICULTURE\',if("DN"=16,\'OPEN\',if("DN"=17,\'URBAN\',if("DN"=18,\'WATER\',if("DN"=19,\'NA\',\'NA\')))))))))))))))', + 'OUTPUT':output}) + + +def sendRequest(self, url, output): + req = urllib.request.Request( + url, + data=None, + headers={ + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' + } + ) + response = urllib.request.urlopen(req, timeout=10) + + totalsize = response.info()['Content-Length'] + currentsize = 0 + chunk = 4096 + with open(output,'wb') as file: + while 1: + data = response.read(chunk) + if not data: + #print ("Download complete.") + break + file.write(data) + currentsize += chunk + try: #Try required for the soil dbf file... maybe file size too small + Handle_Progress(self,currentsize,int(totalsize)) + except: + self.dlg.progress_gisdownload.setValue(100) + + +def Handle_Progress(self,blocksize, totalsize): + if totalsize > 0: + download_percentage = (blocksize / totalsize) * 100 + self.dlg.progress_gisdownload.setValue(download_percentage) + QApplication.processEvents() + + +def extractarchives(file): + folder = os.path.dirname(file) + filename, extension = os.path.splitext(file) + + if extension == '.zip': + with zipfile.ZipFile(file, 'r') as zip_ref: + for elem in zip_ref.namelist(): + filename = os.path.basename(elem) + # skip directories + if not filename: + continue + source = zip_ref.open(elem) + target = open(os.path.join(folder, filename), "wb") + with source, target: + shutil.copyfileobj(source, target) + QApplication.processEvents() + + elif extension == '.tgz' or extension == '.tar': + tar = tarfile.open(file) + for member in tar.getmembers(): + if member.isreg(): # skip if the TarInfo is not files + if 'nariv' in member.name: + member.name = os.path.basename(member.name) + tar.extract(member,folder) # extract + QApplication.processEvents() + os.remove(file) + + +def qgisprogressbar(progress): + progressbar.setValue(progress) + #self.dlg.progress_gisprocess.setValue(progress) + QApplication.processEvents() + + +def makefolders(path): + if not os.path.exists(path): + os.makedirs(path) diff --git a/qraven/modules/datascrapers/streamflow.py b/qraven/modules/datascrapers/streamflow.py new file mode 100644 index 0000000..a491d04 --- /dev/null +++ b/qraven/modules/datascrapers/streamflow.py @@ -0,0 +1,276 @@ +import requests, csv, datetime +from html.parser import HTMLParser +import re + +class cehq: + + def sendRequest(city,river,region): + url = "https://www.cehq.gouv.qc.ca/hydrometrie/historique_donnees/ListeStation.asp?regionhydro=aucune&Tri=Non" + headers = {'User-Agent': 'Mozilla/5.0'} + payload = {'lstStation':'', + 'BtnRechercher1':'Rechercher', + 'lstMunicipalite':city.encode("latin-1"), + 'lstRiviere':river.encode("latin-1"), + 'lstRegion':region.encode("latin-1") + } + + r= requests.post(url,headers=headers,data=payload) + return r.text + + def parseTable(data): + valu= [] + for line in data: + line = line.splitlines() + if line != '' and line[0] !='': + valu.append(line) + stations = [] + tmplist = [] + reachedtable = False + for data in valu: + if data[0].isnumeric() and len(data[0]) > 1: + count = 0 + reachedtable = True + tmplist.append(data[0]) + elif reachedtable == False: + pass + elif count <=8: + text = data[0].replace('\xa0','') + if text !='': + tmplist.append(text) + count+=1 + if count == 8 and reachedtable == True: + stations.append(tmplist.copy()) + tmplist.clear() + reachedtable = False + stations = [x for x in stations if x[7] != 'Niveau'] + return stations + + def downloadData(station): + baseurl = 'https://www.cehq.gouv.qc.ca/depot/historique_donnees/fichier/' + sufix = '_Q.txt' + link = baseurl + station + sufix + page = requests.get(link) + content = page.text + return content + + def extractData(data,id): + isContent = False + observationtmp = [] + lat = "" + lon = "" + area = "" + + for i, line in enumerate(data.split('\n')): + if 'Bassin versant' in line: + line = line.split() + area = line[2] + + if 'Coordonnées' in line: + line = line.split() + lat = line[2]+line[3]+line[4]+'N' #Add the degrees minutes seconds coordinate of the station... could break at some point + lon = line[6]+line[7]+line[8]+'W' + + if 'Station' in line and 'Date' in line and 'Débit' in line: + isContent = True + elif isContent: + if line !='': + content = line.split() + try: + content[2] + observationtmp.append(content) + except: + text = content[0] + ' ' + content[1] + ' -1.2345' + ' MJ' + observationtmp.append(text.split()) + + lat = toLatLon(lat) + lon = toLatLon(lon) + stationinfo = [id, lat, lon, area] + return observationtmp, stationinfo + + + def exportRVT(data,path,mode,startdate,enddate): + isContent = False + observationtmp = [] + + if mode == 'web': + observationtmp = data + elif mode == 'local': + isContent = False + with open(data,'r',encoding = 'latin-1') as file: + for line in file: + content = line.split() + if 'Station' in content and 'Date' in line and 'Débit' in content: + isContent = True + elif isContent: + try: + content[2] + observationtmp.append(content) + except: + text = content[0] + ' ' + content[1] + ' -1.2345' + ' MJ' + observationtmp.append(text.split()) + del observationtmp[0] + + observation =[] + for row in observationtmp: + obsdate = datetime.datetime.strptime(row[1], '%Y/%m/%d') + if obsdate.date() >= startdate and obsdate.date() < enddate: + observation.append(row) + else: + pass + + totalLines = len(observation) + with open(path,'w') as rvt: + rvt.write(':ObservationData HYDROGRAPH m3/s \n') + rvt.write('\t'+observation[0][1].replace('/','-') + ' 00:00:00 ' + str(totalLines)) + for line in observation: + rvt.write('\n\t'+line[2]) + rvt.write('\n:EndObservationData') + + +class watersurvey: + + def sendRequest(type,value,regulation,status): + + baseurl = 'https://wateroffice.ec.gc.ca/search/historical_results_e.html' + params = { 'search_type':type,type: value, + 'parameter_type': 'flows', 'start_year':'1850', + 'end_year':'2023', 'minimum_years':'', + 'regulation' : regulation, 'station_status': status, + 'gross_drainage_operator':'>', 'gross_drainage_area':'', + 'effective_drainage_operator':'>','effective_drainage_area':'' + } + + r = requests.get(url=baseurl,params=params) + + return r.text + + def parseTable(data): + results = [] + tmplist = [] + count = 0 + newlist = False + + for line in data: + line = line.splitlines() + if newlist == True and count == 2: + try: + float(line[0].replace(",",'.')) + tmplist.append(line[0]) + #del tmplist[-3:] + results.append(tmplist.copy()) + tmplist.clear() + count = 0 + newlist = False + except: + tmplist.append('') + #del tmplist[-3:] + results.append(tmplist.copy()) + tmplist.clear() + tmplist.append(line[0]) + count = 0 + newlist = False + elif '°' in line[0]: + count+=1 + tmplist.append(line[0]) + newlist = True + else: + tmplist.append(line[0]) + + results = [x for x in results if x != []] + + #Brings the station IDs to the front of the lists + for result in results: + try: + result.insert(0, result.pop(3)) + result[-3] = toLatLon(result[-3]) + result[-2] = toLatLon(result[-2]) + except: + print("Couldn't move the id in front of the string.") + return results + + + def downloadData(id): + url = 'https://wateroffice.ec.gc.ca/search/relay_e.html' + headers = {'results_type': 'historical', + 'download': 'download?', + 'check[]': id+',1,1959,2021,Flow' + } + + s=requests.session() + s.get(url,params=headers,) + + headers2 = {'dt': 'dd', + 'df': 'ddf', + 'md': '1', + 'ext': 'csv' + } + + url2= 'https://wateroffice.ec.gc.ca/download/report_e.html' + r = s.get(url2,params=headers2,) + + return r.text + + def fetchDates(data): + reader = csv.reader(data.split('\n')) + observationtmp =[] + for row in reader: + observationtmp.append(row) + del observationtmp[:2] + observationtmp = [x for x in observationtmp if x != []] + startdate = observationtmp[0][2] + enddate = observationtmp[-1][2] + return startdate, enddate + + + def exportRVT(data,path, startdate, enddate): + reader = csv.reader(data.split('\n')) + observationtmp =[] + observation = [] + + for row in reader: + observationtmp.append(row) + del observationtmp[:2] + observationtmp = [x for x in observationtmp if x != []] + + for row in observationtmp: + obsdate = datetime.datetime.strptime(row[2], '%Y/%m/%d') + if obsdate.date() >= startdate and obsdate.date() < enddate: + observation.append(row) + else: + pass + + with open(path,'w') as rvt: + rvt.write(':ObservationData HYDROGRAPH m3/s \n') + rvt.write('\t'+observation[0][2].replace('/','-') + ' 00:00:00 ' + str(len(observation))) + for line in observation: + if line[3] != '': + rvt.write('\n\t' + line[3]) + else: + rvt.write('\n\t' + '-1.2345') + rvt.write('\n:EndObservationData') + + +class MyHTMLParser(HTMLParser): + + def __init__(self): + super().__init__() + self.data = [] + self.capture = False + + def handle_starttag(self, tag, attrs): + if tag in ('td'): + self.capture = True + + def handle_endtag(self, tag): + if tag in ('td'): + self.capture = False + + def handle_data(self, data): + if self.capture: + self.data.append(data) + + +def toLatLon(coord): + deg, minutes, seconds, direction = re.split('[°\'"]', coord) + newcoord=(abs(float(deg)) + (float(minutes)/60) + (float(seconds)/(3600))) * (-1 if direction.strip() in ['W', 'S'] else 1) + return newcoord \ No newline at end of file diff --git a/qraven/modules/docker/__pycache__/dockercmd.cpython-39.pyc b/qraven/modules/docker/__pycache__/dockercmd.cpython-39.pyc deleted file mode 100644 index 1877838..0000000 Binary files a/qraven/modules/docker/__pycache__/dockercmd.cpython-39.pyc and /dev/null differ diff --git a/qraven/modules/docker/dockercmd.py b/qraven/modules/docker/dockercmd.py index c533d93..33dae12 100644 --- a/qraven/modules/docker/dockercmd.py +++ b/qraven/modules/docker/dockercmd.py @@ -2,6 +2,7 @@ import subprocess from pathlib import Path from qgis.core import QgsVectorLayer, QgsProject +from PyQt5.QtWidgets import * #This method runs the command that it receives with subprocess def dockerCommand(cmd, computerOS): @@ -16,7 +17,9 @@ def dockerCommand(cmd, computerOS): process = subprocess.Popen(cmd, stdout=subprocess.PIPE,startupinfo=startupinfo) else: process = subprocess.Popen(cmd, stdout=subprocess.PIPE) + #QApplication.processEvents() #Unfreezes the GUI, but slows down the process heavily while True: + output = process.stdout.readline() if output == b'': break @@ -42,7 +45,7 @@ def dockerdelete(self): print(e) #This method pulls the scriptbash/qraven docker container -def dockerPull(computerOS): +def dockerPull(computerOS, contnrCMD,image): '''Pulls the scriptbash/qraven docker container Depends on the following method: @@ -50,20 +53,16 @@ def dockerPull(computerOS): dockerCommand() ''' try: - if computerOS !='macos': - print("Trying to pull the scriptbash/qraven image...") - cmd='docker', 'pull', 'scriptbash/qraven:latest' - dockerCommand(cmd, computerOS) - else: - print("Trying to pull the scriptbash/qraven_arm image...") - cmd='docker', 'pull', 'scriptbash/qraven_arm:latest' - dockerCommand(cmd,computerOS) + print("Trying to pull the "+image+" image...") + cmd=contnrCMD, 'pull', image + dockerCommand(cmd, computerOS) + print("The pull was successfull") except Exception as e: print(e) #This method starts the docker container -def dockerStart(computerOS): +def dockerStart(computerOS,contnrCMD, image): '''Starts the docker container detached, with a pseudo-tty. The working directory is /root/BasinMaker Depends on the following method: @@ -71,24 +70,19 @@ def dockerStart(computerOS): dockerCommand() ''' try: - print("Attempting to start the container...") - if computerOS != 'macos': - cmd='docker', 'run', '-t', '-d','-w','/root/BasinMaker','--name', 'qraven', 'scriptbash/qraven' - dockerCommand(cmd, computerOS) - else: - cmd='docker', 'run', '-t', '-d','-w','/root/BasinMaker','--name', 'qraven', 'scriptbash/qraven_arm' - dockerCommand(cmd, computerOS) + cmd=contnrCMD, 'run', '-t', '-d','-w','/root/BasinMaker','--name', 'qraven', image + dockerCommand(cmd, computerOS) print("The container was started successfully") except Exception as e: print(e) #This function stops the docker container and removes it -def dockerStop(): - os.system("docker stop qraven") #Stops the container after the process - os.system("docker rm qraven") #Deletes the container +def dockerStop(contnrCMD): + os.system(contnrCMD+" stop qraven") #Stops the container after the process + os.system(contnrCMD+" rm qraven") #Deletes the container #This method starts the create_RVH.py script -def runBasinMaker(computerOS): +def runBasinMaker(computerOS,contnrCMD): '''Launches the create_RVH.py script inside the Docker container. Uses the bash shell in interactive mode in order to get the proper python paths and environment variables set in ~/.bashrc. @@ -99,7 +93,7 @@ def runBasinMaker(computerOS): ''' print("Starting BasinMaker process, this will take a while to complete") pythoncmd = "python3 -u create_RVH.py" #Bash command to start the BasinMaker script - cmd ='docker', 'exec','-t', 'qraven','/bin/bash','-i','-c',pythoncmd #Docker command to run the script + cmd =contnrCMD, 'exec','-t', 'qraven','/bin/bash','-i','-c',pythoncmd #Docker command to run the script try: # os.system("docker start qraven") #Make sure the container is started. Only needed when the plugin is run a second time dockerCommand(cmd, computerOS) @@ -109,7 +103,7 @@ def runBasinMaker(computerOS): print(e) #This method copies the RVH parameters file and the user's data to the docker container -def dockerCopy(self, params, computerOS, separator): +def dockerCopy(self, params, computerOS, separator,contnrCMD): '''Copy the RVH parameters file and the user's geospatial data to the Docker container''' outputdir = self.dlg.file_outputfolder.filePath() #Get the output directory dockerBMpath = '/root/BasinMaker' #The path to the BasinMaker folder inside the container @@ -143,7 +137,7 @@ def dockerCopy(self, params, computerOS, separator): } shpExt = ['cfg', 'dbf', 'prj','qmd','shp', 'shx'] #List with the shapefile extensions rvhScript = outputdir+separator+ "parameters.txt" #Get the path to the exported parameters file - cmd='docker', 'cp', rvhScript, 'qraven:'+ dockerBMpath + cmd=contnrCMD, 'cp', rvhScript, 'qraven:'+ dockerBMpath dockerCommand(cmd, computerOS) #Loop through the dictionary of paths @@ -152,69 +146,69 @@ def dockerCopy(self, params, computerOS, separator): filename = Path(path).stem #Get the file name without extension and path folder = os.path.dirname(path) #Get only the file path (without the file name) if key == 'dem': - cmdData='docker', 'cp', params['pathdem'], 'qraven:'+ dockerDEMPath + cmdData=contnrCMD, 'cp', params['pathdem'], 'qraven:'+ dockerDEMPath dockerCommand(cmdData, computerOS) #Sends the DEM to the container elif key == 'landusepoly': for extension in shpExt: file = folder+separator+filename + '.' + extension - cmdData='docker', 'cp', file, 'qraven:'+ dockerLandusePath + cmdData=contnrCMD, 'cp', file, 'qraven:'+ dockerLandusePath dockerCommand(cmdData, computerOS) #Sends the complete landuse polygon shapefile to the container elif key == 'landuserast': - cmdData='docker', 'cp', params['pathlanduserast'], 'qraven:'+ dockerLandusePath + cmdData=contnrCMD, 'cp', params['pathlanduserast'], 'qraven:'+ dockerLandusePath dockerCommand(cmdData, computerOS) #Sends the landuse raster to the container elif key == 'lakes': for extension in shpExt: file = folder+separator+filename + '.' + extension - cmdData='docker', 'cp', file, 'qraven:'+ dockerLakesPath + cmdData=contnrCMD, 'cp', file, 'qraven:'+ dockerLakesPath dockerCommand(cmdData, computerOS) #Sends the complete lakes shapefile to the container elif key == 'bankfull': for extension in shpExt: file = folder+separator+filename + '.' + extension - cmdData='docker', 'cp', file, 'qraven:'+ dockerBankfullPath + cmdData=contnrCMD, 'cp', file, 'qraven:'+ dockerBankfullPath dockerCommand(cmdData, computerOS) #Sends the complete bankfull width shapefile to the container elif key == 'soil': for extension in shpExt: file = folder+separator+filename + '.' + extension - cmdData='docker', 'cp', file, 'qraven:'+ dockerSoilPath + cmdData=contnrCMD, 'cp', file, 'qraven:'+ dockerSoilPath dockerCommand(cmdData, computerOS) #Sends the complete soil shapefile to the container elif key == 'pointinterest': for extension in shpExt: file = folder+separator+filename + '.' + extension - cmdData='docker', 'cp', file, 'qraven:'+ dockerPoIPath + cmdData=contnrCMD, 'cp', file, 'qraven:'+ dockerPoIPath dockerCommand(cmdData, computerOS) #Sends the complete point of interest shapefile to the container elif key == 'hybasin': for extension in shpExt: file = folder+separator+filename + '.' + extension - cmdData='docker', 'cp', file, 'qraven:'+ dockerHybasinPath + cmdData=contnrCMD, 'cp', file, 'qraven:'+ dockerHybasinPath dockerCommand(cmdData, computerOS) #Sends the complete hydro basin shapefile to the container elif key == 'provpoly': for extension in shpExt: file = folder+separator+filename + '.' + extension - cmdData='docker', 'cp', file, 'qraven:'+ dockerProvPolyPath + cmdData=contnrCMD, 'cp', file, 'qraven:'+ dockerProvPolyPath dockerCommand(cmdData, computerOS) #Sends the complete extent polygon shapefile to the container elif key == 'manning': for extension in shpExt: - cmdData='docker', 'cp', params['landusemanning'], 'qraven:'+ dockerLandusePath + cmdData=contnrCMD, 'cp', params['landusemanning'], 'qraven:'+ dockerLandusePath dockerCommand(cmdData, computerOS) #Sends the landuse manning table to the container elif key == 'flowdirection': for extension in shpExt: - cmdData='docker', 'cp', params['pathfdr'], 'qraven:'+ dockerFDRPath + cmdData=contnrCMD, 'cp', params['pathfdr'], 'qraven:'+ dockerFDRPath dockerCommand(cmdData, computerOS) #Sends flow direction file to the container elif key == 'landuseinfo': - cmdData='docker', 'cp', params['pathlanduseinfo'], 'qraven:'+ dockerLandusePath + cmdData=contnrCMD, 'cp', params['pathlanduseinfo'], 'qraven:'+ dockerLandusePath dockerCommand(cmdData, computerOS) #Sends landuse info csv file to the container elif key == 'soilinfo': - cmdData='docker', 'cp', params['pathsoilinfo'], 'qraven:'+ dockerSoilPath + cmdData=contnrCMD, 'cp', params['pathsoilinfo'], 'qraven:'+ dockerSoilPath dockerCommand(cmdData, computerOS) #Sends soil info csv file to the container elif key == 'veginfo': - cmdData='docker', 'cp', params['pathveginfo'], 'qraven:'+ dockerLandusePath + cmdData=contnrCMD, 'cp', params['pathveginfo'], 'qraven:'+ dockerLandusePath dockerCommand(cmdData, computerOS) #Sends vegetation csv file to the container print("Done copying the files to the container") #This method retrieves the results folder generated by BasinMaker and saves it in the user's output directory -def getDockerResults(self, computerOS, separator): +def getDockerResults(self, computerOS, separator, contnrCMD): '''Grabs the OIH_Output folder from the Docker container and places it into the user's specified directory Depends on the following method: @@ -224,7 +218,7 @@ def getDockerResults(self, computerOS, separator): outputdir = self.dlg.file_outputfolder.filePath() #Get the output directory dockerBMResultsPath = '/root/BasinMaker/OIH_Output' #Get the docker path where the results are print("Grabbing the results, this could take a while...") - cmd ='docker', 'cp','qraven:'+dockerBMResultsPath, outputdir + cmd =contnrCMD, 'cp','qraven:'+dockerBMResultsPath, outputdir try: dockerCommand(cmd, computerOS) print("The results are now in " + outputdir) diff --git a/qraven/modules/hydrologicproc.py b/qraven/modules/hydrologicproc.py new file mode 100644 index 0000000..5245922 --- /dev/null +++ b/qraven/modules/hydrologicproc.py @@ -0,0 +1,708 @@ +from qgis.PyQt.QtWidgets import * + +def addprocess(self): + + table = self.dlg.table_hydroprocess #Get the hydrologic processes table + currentRow = table.rowCount() #Get the number of rows the table has + table.insertRow(currentRow) #Inserts a new row below the last row + + combo_proc = QComboBox() + combo_alg = QComboBox() + combo_from = QComboBox() + combo_from2 = QComboBox() + combo_from2.setEnabled(False) + combo_to = QComboBox() + combo_to2 = QComboBox() + combo_to2.setEnabled(False) + + chk_isconditional = QCheckBox() + + combo_basedtype = QComboBox() + combo_comparison = QComboBox() + + txt_hrutype = QLineEdit() + + chk_mixingrate = QCheckBox() + spin_pct = QDoubleSpinBox() + + chk_interbasin = QCheckBox() + + combo_proc.addItems(procname) #Add a combobox in the new row with all the available processes + combo_basedtype.setEnabled(False) + combo_comparison.setEnabled(False) + txt_hrutype.setEnabled(False) + chk_mixingrate.setEnabled(False) + spin_pct.setEnabled(False) + spin_pct.setDecimals(1) + chk_interbasin.setEnabled(False) + table.setCellWidget(currentRow, 0, combo_proc) #Sets the new combobox in the first column and in the new row + table.setCellWidget(currentRow, 1, combo_alg) + table.setCellWidget(currentRow, 2, combo_from) + table.setCellWidget(currentRow, 3, combo_from2) + table.setCellWidget(currentRow, 4, combo_to) + table.setCellWidget(currentRow, 5, combo_to2) + table.setCellWidget(currentRow, 6, chk_isconditional) + table.setCellWidget(currentRow, 7, combo_basedtype) + table.setCellWidget(currentRow, 8, combo_comparison) + table.setCellWidget(currentRow, 9, txt_hrutype) + table.setCellWidget(currentRow, 10, chk_mixingrate) + table.setCellWidget(currentRow, 11, spin_pct) + table.setCellWidget(currentRow, 12, chk_interbasin) + + table.resizeColumnsToContents() #Resizes the width of the column automatically + combo_proc.currentIndexChanged.connect(lambda:setProcAlg(self,currentRow)) #Updates the algorithm combobox if the process changes + chk_isconditional.stateChanged.connect(lambda:enableConditionalProc(self, currentRow)) + + +def removeprocess(self): + table = self.dlg.table_hydroprocess + selectedRow = table.currentRow() + table.removeRow(selectedRow) + + +def setProcAlg(self,row): + #print('Went into the algs') + table = self.dlg.table_hydroprocess + + combo_proc = table.cellWidget(row, 0) + combo_alg = table.cellWidget(row, 1) #Sets the new combobox in the first column and in the new row + combo_from2 = table.cellWidget(row, 3) + combo_to2 = table.cellWidget(row, 5) + chk_mixingrate = table.cellWidget(row, 10) + spin_pct = table.cellWidget(row, 11) + chk_interbasin = table.cellWidget(row, 12) + + combo_from2.setEnabled(False) + combo_to2.setEnabled(False) + combo_alg.setEnabled(True) + spin_pct.setEnabled(False) + chk_interbasin.setChecked(False) + chk_interbasin.setEnabled(False) + chk_mixingrate.setChecked(False) + chk_mixingrate.setEnabled(False) + #currentWidget = self.dlg.sender() + # index = self.dlg.table_hydroprocess.indexAt(currentWidget.pos()) + # widgetRow = index.row() + combo_alg.clear() + combo_from2.clear() + combo_to2.clear() + combo_alg.addItem('') + + # if isinstance(currentWidget, QComboBox): + selectedProc = combo_proc.currentText() + #print(selectedProc) + if selectedProc == 'Precipitation': + combo_alg.addItems(precipalg) + elif selectedProc == 'CanopyEvaporation': + combo_alg.addItems(canopevapAlg) + elif selectedProc == 'CanopySublimation': + combo_alg.addItems(canopysublimationAlg) + elif selectedProc == 'SoilEvaporation': + combo_alg.addItems(soilevapAlg) + elif selectedProc == 'LakeEvaporation': + combo_alg.addItems(lakeevapAlg) + elif selectedProc == 'OpenWaterEvaporation': + combo_alg.addItems(openwaterevapAlg) + elif selectedProc == 'Infiltration': + combo_alg.addItems(infiltrationAlg) + elif selectedProc == 'Percolation': + combo_alg.addItems(percolationAlg) + elif selectedProc == 'CapillaryRise': + combo_alg.addItems(cappilaryriseAlg) + elif selectedProc == 'Baseflow': + combo_alg.addItems(baseflowAlg) + elif selectedProc == 'Interflow': + combo_alg.addItems(interflowAlg) + elif selectedProc == 'Seepage': + combo_alg.addItems(seepageAlg) + elif selectedProc == 'DepressionOverflow': + combo_alg.addItems(depresoverflowAlg) + elif selectedProc == 'LakeRelease': + combo_alg.addItems(lakereleaseAlg) + elif selectedProc == 'Abstraction': + combo_alg.addItems(abstractionAlg) + elif selectedProc == 'SnowMelt': + combo_alg.addItems(snowmeltAlg) + elif selectedProc == 'SnowRefreeze': + combo_alg.addItems(snowrefreezeAlg) + elif selectedProc == 'SnowBalance': + combo_alg.addItems(snowbalanceAlg) + elif selectedProc == 'SnowTempEvolve': + combo_alg.addItems(snowtempevolveAlg) + elif selectedProc == 'Sublimation': + combo_alg.addItems(sublimationAlg) + elif selectedProc == 'SnowAlbedoEvolve': + combo_alg.addItems(snowalbedoevolveAlg) + elif selectedProc == 'SnowSqueeze': + combo_alg.addItems(snowsqueezeAlg) + elif selectedProc == 'CanopyDrip': + combo_alg.addItems(canopydripAlg) + elif selectedProc == 'CropHeatUnitEvolve': + combo_alg.addItems(cropheatunitevAlg) + elif selectedProc == 'GlacierMelt': + combo_alg.addItems(glaciermeltAlg) + elif selectedProc == 'GlacierRelease': + combo_alg.addItems(glacierreleaseAlg) + elif selectedProc == 'GlacierInfiltration': + combo_alg.addItems(glacierinfiltrationAlg) + elif selectedProc == 'Flush': + combo_alg.addItems(flushAlg) + chk_mixingrate.setEnabled(True) + elif selectedProc == 'Overflow': + combo_alg.addItems(overflowAlg) + elif selectedProc == 'Abstraction': + combo_alg.addItems(abstractionAlg) + elif selectedProc == 'Split': + combo_to2.setEnabled(True) + combo_alg.addItems(splitAlg) + chk_mixingrate.setEnabled(True) + elif selectedProc == 'Convolve': + combo_alg.addItems(convolutionAlg) + elif selectedProc == 'LateralFlush': + combo_from2.setEnabled(True) + combo_to2.setEnabled(True) + combo_alg.addItems(lateralflushAlg) + elif selectedProc == 'LateralEquilibrate': + combo_alg.addItems(lateralequilibrateAlg) + spin_pct.setEnabled(True) + spin_pct.setSingleStep(0.1) + spin_pct.setMaximum(1.0) + spin_pct.setMinimum(0.0) + spin_pct.setDecimals(1) + chk_interbasin.setEnabled(True) + elif selectedProc == 'ExchangeFlow': + combo_alg.addItems(exchangeflowAlg) + elif selectedProc == 'Recharge': + combo_alg.addItems(rechargeAlg) + elif selectedProc == 'BlowingSnow': + combo_alg.addItems(blowingsnowAlg) + elif selectedProc == 'SoilBalance': + combo_alg.addItems(soilbalanceAlg) + elif selectedProc == 'RedirectFlow': + combo_alg.setEnabled(False) + + #table.setCellWidget(row, 1, combo_alg) + #table.setCellWidget(row, 2, combo_from) + #table.setCellWidget(row, 3, combo_to) + # table.setCellWidget(row, 8, chk_mixingrate) + # table.setCellWidget(row, 9, spin_pct) + # table.setCellWidget(row, 10, chk_interbasin) + + table.resizeColumnsToContents() + + chk_mixingrate.stateChanged.connect(lambda:enableMixingRate(self,row)) + combo_alg.currentIndexChanged.connect(lambda:setStorage(self, selectedProc, row)) #Updates the compartments combobox if the algorithm changed + #self.setStorage(selectedProc) #Needed for RedirectFlow... there's probably a better way + +#This method sets the combobox values for the from and to compartments based on the selected algorithm +def setStorage(self,selectedProc, row): + + table = self.dlg.table_hydroprocess #Get the hydrologic processes table + + #Clears the lists to avoid infinite duplicates + fromPercolation.clear() + toPercolation.clear() + fromCapillaryRise.clear() + toCapillaryRise.clear() + fromBaseflow.clear() + fromInterflow.clear() + toSeepage.clear() + fromExchangeflow.clear() + toExchangeflow.clear() + fromRecharge.clear() + toRecharge.clear() + fromConvolution.clear() + tmpanyCompartment = anyCompartment.copy() + #Loops through the number of soil layers chosen by the user. Allows to add the soil[m] to comboboxes + if self.dlg.combo_soilmod.currentText().lower() == "soil_multilayer": + numberSoil = int(self.dlg.spin_soilmod.value()) #Get the number of layers + elif self.dlg.combo_soilmod.currentText().lower() == "soil_two_layer": + numberSoil = 2 + else: + numberSoil = 1 + for layer in range(numberSoil): + compartment = "SOIL["+str(layer)+']' #Create the string to append to the list + #Append the soil[m] to the comboboxes + fromPercolation.append(compartment) + toPercolation.append(compartment) + fromCapillaryRise.append(compartment) + toCapillaryRise.append(compartment) + fromBaseflow.append(compartment) + fromInterflow.append(compartment) + toSeepage.append(compartment) + fromExchangeflow.append(compartment) + toExchangeflow.append(compartment) + toRecharge.append(compartment) + tmpanyCompartment.append(compartment) + for layer in range(numberSoil): + compartment = "CONVOLUTION["+str(layer)+']' + fromConvolution.append(compartment) + tmpanyCompartment.append(compartment) + + tmpanyCompartment = list(dict.fromkeys(tmpanyCompartment)) + #tmpanyCompartment.sort() + #currentWidget = self.dlg.sender() #Get the widget that was triggered + #index = self.dlg.table_hydroprocess.indexAt(currentWidget.pos()) #Get the index of the widget + #widgetRow = index.row() #Get the row in which the widget is set + # combo_from = QComboBox() #Initialize the combobox for the from compartment + # combo_to = QComboBox() #Initialize the combobox for the to compartment + combo_proc = table.cellWidget(row, 0) + combo_alg = table.cellWidget(row, 1) + combo_from = table.cellWidget(row, 2) + combo_from2 = table.cellWidget(row,3) + combo_to = table.cellWidget(row, 4) + combo_to2 = table.cellWidget(row,5) + combo_from.clear() + combo_to.clear() + combo_from2.clear() + combo_to2.clear() + + + + #Sets the value of the compartments based on the selected algorithm + #if isinstance(sel, QComboBox): + + selectedProc = combo_proc.currentText() + selectedAlg = combo_alg.currentText() + #hrugroups = [x.strip() for x in self.dlg.txt_defhru.toPlainText().split(',')] + #combo_from.addItems(hrugroups) + + #if selectedAlg == 'RAVEN_DEFAULT': + #combo_from.addItems(tmpanyCompartment) + #combo_to.addItems(tmpanyCompartment)# + if selectedAlg in precipalg and selectedProc == 'Precipitation': + combo_from.addItems(fromPrecip) + combo_to.addItems(toPrecip) + elif selectedAlg in canopevapAlg: + combo_from.addItems(fromCanevp) + combo_to.addItems(toCanevp) + elif selectedAlg in canopysublimationAlg: + combo_from.addItems(fromCanopySublimation) + combo_to.addItems(toCanopySublimation) + elif selectedAlg in soilevapAlg: + combo_from.addItems(fromSoilevap) + combo_to.addItems(toSoilevap) + elif selectedAlg in lakeevapAlg: + combo_from.addItems(tmpanyCompartment) + combo_to.addItems(toLakeevap) + elif selectedAlg in openwaterevapAlg: + combo_from.addItems(fromOpenwaterevap) + combo_to.addItems(toOpenwaterevap) + elif selectedAlg in infiltrationAlg: + if selectedAlg =='INF_UBC': + combo_from.addItems(fromInfiltration) + combo_to.addItems(toInfiltUBC) + elif selectedAlg =='INF_HMETS': + combo_from.addItems(fromInfiltration) + combo_to.addItems(toInfiltHMETS) + elif selectedAlg =='INF_GA_SIMPLE': + combo_from.addItems(fromInfiltGAsimple) + combo_to.addItems(toInfiltGAsimple) + else: + combo_from.addItems(fromInfiltration) + combo_to.addItems(toInfiltration) + elif selectedAlg in rechargeAlg and selectedProc == 'Recharge': + combo_from.addItems(fromRecharge) + combo_to.addItems(toRecharge) + elif selectedAlg in percolationAlg: + combo_from.addItems(fromPercolation) + combo_to.addItems(toPercolation) + elif selectedAlg in cappilaryriseAlg: + combo_from.addItems(fromCapillaryRise) + combo_to.addItems(toCapillaryRise) + elif selectedAlg in baseflowAlg: + combo_from.addItems(fromBaseflow) + combo_to.addItems(toBaseflow) + elif selectedAlg in interflowAlg: + combo_from.addItems(fromInterflow) + combo_to.addItems(toInterflow) + elif selectedAlg in seepageAlg: + combo_from.addItems(fromSeepage) + combo_to.addItems(toSeepage) + elif selectedAlg in depresoverflowAlg: + combo_from.addItems(fromDepressOverflow) + combo_to.addItems(toDepressOverflow) + elif selectedAlg in lakereleaseAlg: + combo_from.addItems(fromLakeRelease) + combo_to.addItems(toLakeRelease) + elif selectedAlg in abstractionAlg: + if selectedAlg == 'ABST_PDMROF': + combo_from.addItems(fromAbstraction) + combo_to.addItems(toAbstractionPDMROF) + else: + combo_from.addItems(fromAbstraction) + combo_to.addItems(toAbstraction) + elif selectedAlg in snowbalanceAlg: + if selectedAlg == 'SNOBAL_SIMPLE_MELT': + combo_from.addItems(fromSnowbalSimple) + combo_to.addItems(toSnowbalSimple) + elif selectedAlg == 'SNOBAL_COLD_CONTENT': + combo_from.addItems(fromSnowbalColdcontent) + combo_to.addItems(toSnowbalColdcontent) + elif selectedAlg == 'SNOBAL_HBV': + combo_from.addItems(fromSnowbalHBV) + combo_to.addItems(toSnowbalHBV) + elif selectedAlg == 'SNOBAL_TWO_LAYER': + combo_from.addItems(fromSnowbaltwolayer) + combo_to.addItems(toSnowbaltwolayer) + elif selectedAlg == 'SNOBAL_CEMA_NEIGE': + combo_from.addItems(fromSnowbalCema) + combo_to.addItems(toSnowbalCema) + elif selectedAlg == 'SNOBAL_GAWSER': + combo_from.addItems(fromSnowbalGawser) + combo_to.addItems(toSnowbalGawser) + elif selectedAlg == 'SNOBAL_HMETS': + combo_from.addItems(fromSnowbalHMETS) + combo_to.addItems(toSnowbalHMETS) + elif selectedAlg == 'SNOBAL_UBCWM': + combo_from.addItems(fromSnowbalUBCWM) + combo_to.addItems(toSnowbalUBCWM) + elif selectedAlg in snowtempevolveAlg: + combo_from.addItems(fromSnowtempEvolve) + combo_to.addItems(toSnowtempEvolve) + elif selectedAlg in snowmeltAlg: + combo_from.addItems(fromSnowmelt) + combo_to.addItems(toSnowmelt) + elif selectedAlg in snowrefreezeAlg: + combo_from.addItems(fromSnowrefreeze) + combo_to.addItems(tmpanyCompartment) + elif selectedAlg in snowsqueezeAlg: + combo_from.addItems(fromSnowsqueeze) + combo_to.addItems(tmpanyCompartment) + elif selectedAlg in blowingsnowAlg: + combo_from.addItems(fromBlowingsnow) + combo_to.addItems(toBlowingsnow) + elif selectedAlg in snowalbedoevolveAlg: + if selectedAlg == 'SNOALB_BAKER': + combo_from.addItems(fromSnowalbevoBaker) + combo_to.addItems(toSnowalbevoBaker) + else: + combo_from.addItems(fromSnowalbevo) + combo_to.addItems(toSnowalbevo) + elif selectedAlg in sublimationAlg: + combo_from.addItems(fromSublimation) + combo_to.addItems(toSublimation) + elif selectedAlg in canopydripAlg: + combo_from.addItems(fromCanopydrip) + combo_to.addItems(toCanopydrip) + elif selectedAlg in glaciermeltAlg: + combo_from.addItems(fromGlaciermelt) + if selectedAlg == 'GMELT_UBC': + combo_to.addItems(toGlaciermeltUBC) + else: + combo_to.addItems(toGlaciermelt) + elif selectedAlg in glacierreleaseAlg: + combo_from.addItems(fromGlacierRelease) + combo_to.addItems(toGlacierRelease) + elif selectedAlg in glacierinfiltrationAlg: + combo_from.addItems(fromGlacierInfiltration) + combo_to.addItems(toGlacierInfiltration) + elif selectedAlg in exchangeflowAlg and selectedProc == 'ExchangeFlow': + combo_from.addItems(fromExchangeflow) + combo_to.addItems(toExchangeflow) + elif selectedAlg in convolutionAlg: + combo_from.addItems(fromConvolution) + combo_to.addItems(tmpanyCompartment) + elif selectedAlg in cropheatunitevAlg: + combo_from.addItems(fromCropheatunit) + combo_to.addItems(toCropheatunit) + elif selectedProc == 'RedirectFlow': + #fromredirectflow = self.dlg.table_hydroprocess.cellWidget(widgetRow-1,2).currentText() + #toredirectflow = self.dlg.table_hydroprocess.cellWidget(widgetRow-1,3).currentText() + combo_from.addItems(tmpanyCompartment) + combo_to.addItems(tmpanyCompartment) + elif selectedProc == 'LateralFlush': + hrugroups = [x.strip() for x in self.dlg.txt_defhru.toPlainText().split(',')] + combo_from2.addItem('') + combo_to2.addItem('') + combo_from2.addItems(statevariables) + combo_to2.addItems(statevariables) + if hrugroups[0] !='': + combo_from.addItems(hrugroups) + combo_to.addItems(hrugroups) + else: + combo_from.addItem('HRUs undefined') + combo_to.addItem('HRUs undefined') + + elif selectedProc == 'Flush' or selectedProc == "Overflow" or selectedProc == 'Split' or selectedProc == 'LateralEquilibrate': + if selectedProc == 'LateralEquilibrate': + tmpanyCompartment.append('AllHRUs') + elif selectedProc == 'Split': + combo_to2.addItems(tmpanyCompartment) + combo_from.addItems(tmpanyCompartment) + combo_to.addItems(tmpanyCompartment) + # table.setCellWidget(row, 2, combo_from) #Set the combobox for the from compartment + # table.setCellWidget(row, 3, combo_to) #Set the combobox for the to compartment + table.resizeColumnsToContents() #Resizes automatically the columns + + +def enableConditionalProc(self,row): + + basedtype = ['HRU_TYPE','HRU_GROUP','LAND_CLASS','VEGETATION'] + comparison = ['IS', 'IS_NOT'] + + table = self.dlg.table_hydroprocess + + chk_isConditional = table.cellWidget(row, 6) + combo_basedtype = table.cellWidget(row, 7) + combo_comparison = table.cellWidget(row, 8) + txt_hrutype = table.cellWidget(row, 9) + + combo_basedtype.clear() + combo_comparison.clear() + txt_hrutype.clear() + if chk_isConditional.isChecked(): + combo_basedtype.addItems(basedtype) + combo_basedtype.setEnabled(True) + combo_comparison.addItems(comparison) + combo_comparison.setEnabled(True) + txt_hrutype.setEnabled(True) + else: + combo_basedtype.setEnabled(False) + combo_comparison.setEnabled(False) + txt_hrutype.setEnabled(False) + table.resizeColumnsToContents() #Resizes the width of the column automatically + +def enableMixingRate(self, row): + table = self.dlg.table_hydroprocess + # currentWidget = self.dlg.sender() + # index = self.dlg.table_hydroprocess.indexAt(currentWidget.pos()) + # widgetRow = index.row() + chk_mixingrate = table.cellWidget(row, 10) + spin_pct = table.cellWidget(row, 11) + + spin_pct.setSingleStep(0.1) + spin_pct.setMaximum(1.0) + spin_pct.setMinimum(0.0) + spin_pct.setDecimals(1) + + if chk_mixingrate.isChecked(): + spin_pct.setEnabled(True) + else: + spin_pct.setEnabled(False) + #table.setCellWidget(row, 9, spin_pct) + + +#This method creates a list with all the hydrologic processes, which is then used to write them into the rvi file +def getHydroProcess(self): + table = self.dlg.table_hydroprocess + rows = table.rowCount() + cols = table.columnCount() + processesList = [] + for row in range(rows): + for col in range(cols): + currentWidget = table.cellWidget(row,col) + if isinstance(currentWidget, QComboBox): + if col == 3: + if currentWidget.currentText() != '': #It is lateralflush and requires "To" keyword + processesList.append(currentWidget.currentText()+' To ') + else: + processesList.append(currentWidget.currentText()) + elif isinstance(currentWidget, QCheckBox): + if currentWidget.isChecked(): + if col == 6: + processesList.append('condTrue') #The checkbox is Conditional + elif col == 10: + processesList.append('mixTrue') #The checkbox is Mixing rate + elif col == 12: + #processesList.append('interbasinTrue') #The checkbox is Interbasin + processesList.insert(-5,'interbasinTrue') + else: + processesList.append('False') + elif isinstance(currentWidget, QLineEdit): + processesList.append(currentWidget.text().upper()) + elif isinstance(currentWidget, QDoubleSpinBox): + if table.cellWidget(row,10).isChecked() or table.cellWidget(row,0).currentText() == 'LateralEquilibrate': + #processesList.append("{:.1f}".format(currentWidget.value())) + processesList.insert(-5,"{:.1f}".format(currentWidget.value())) + else: + processesList.append('') + processesList.append("NewLine") + return processesList + + +#List that contains every process name +procname = ['','Baseflow','CanopyEvaporation','CanopyDrip','Infiltration', + 'Percolation','SnowMelt','SoilEvaporation','SnowBalance', + 'Sublimation','OpenWaterEvaporation','Precipitation','Interflow', + 'SnowRefreeze','Flush','CapillaryRise','LakeEvaporation','SnowSqueeze', + 'GlacierMelt','GlacierRelease','CanopySublimation', + 'Overflow','SnowAlbedoEvolve','CropHeatUnitEvolve','Abstraction','GlacierInfiltration', + 'Split','Convolve','SnowTempEvolve','DepressionOverflow','ExchangeFlow', + 'LateralFlush','Seepage','Recharge','BlowingSnow','LakeRelease','SoilBalance','LateralEquilibrate','RedirectFlow' + ] +procname.sort() #Sorts the list ascending + +#Lists with all of the Raven algorithms +baseflowAlg = ['BASE_VIC','BASE_TOPMODEL','BASE_LINEAR','BASE_LINEAR_CONSTRAIN', + 'BASE_LINEAR_ANALYTIC','BASE_POWER_LAW','BASE_CONSTANT', + 'BASE_THRESH_POWER','BASE_THRESH_STOR','BASE_GR4J' + ] +canopevapAlg = ['CANEVP_RUTTER','CANEVP_MAXIMUM','CANEVP_ALL'] +canopydripAlg = ['CANDRIP_RUTTER','CANDRIP_SLOWDRAIN'] +infiltrationAlg = ['INF_GREEN_AMPT','INF_GA_SIMPLE','INF_VIC_ARNO','INF_VIC', + 'INF_RATIONAL','INF_PRMS','INF_HBV','INF_UBC','INF_PARTITION', + 'INF_GR4J','INF_SCS','INF_SCS_NOABSTRACTION','INF_HMETS', + 'INF_ALL_INFILTRATES','INF_XINANXIANG','INF_PDM','INF_AWBM' + ] +percolationAlg = ['PERC_POWER_LAW','POWER_LAW','PERC_GAWSER','PERC_GAWSER_CONSTRAIN', + 'PERC_PRMS','PERC_SACRAMENTO','PERC_CONSTANT','PERC_LINEAR', + 'PERC_LINEAR_ANALYTIC','PERC_GR4J','PERC_GR4JEXCH','PERC_GR4JEXCH2','PERC_ASPEN' + ] +snowmeltAlg = ['MELT_POTMELT'] #Obsolete +soilevapAlg = ['SOILEVAP_VIC','SOILEVAP_TOPMODEL','SOILEVAP_SEQUEN','SOILEVAP_ROOT', + 'SOILEVAP_ROOT_CONSTRAIN','SOILEVAP_HBV','SOILEVAP_HYPR','SOILEVAP_UBC', + 'SOILEVAP_PDM','SOILEVAP_CHU','SOILEVAP_GR4J','SOILEVAP_LINEAR', + 'SOILEVAP_SACSMA','SOILEVAP_ALL','SOILEVAP_AWBM' + ] +snowbalanceAlg = ['SNOBAL_COLD_CONTENT','SNOBAL_SIMPLE_MELT','SNOBAL_UBCWM', + 'SNOBAL_HBV','SNOBAL_CEMA_NEIGE','SNOBAL_TWO_LAYER', + 'SNOBAL_GAWSER','SNOBAL_CRHM_EBSM','SNOBAL_HMETS' + ] +sublimationAlg = ['SUBLIM_SVERDRUP','SUBLIM_KUZMIN','SUBLIM_CENTRAL_SIERRA', + 'SUBLIM_PBSM','SUBLIM_KUCHMENT_GELFAN','SUBLIM_BULK_AERO' + ] +openwaterevapAlg = ['OPEN_WATER_EVAP','OPEN_WATER_RIPARIAN','OPEN_WATER_UWFS'] +precipalg = ['PRECIP_RAVEN','RAVEN_DEFAULT'] +interflowAlg = ['PRMS'] +snowrefreezeAlg = ['FREEZE_DEGREE_DAY'] +flushAlg = ['FLUSH_RAVEN','RAVEN_DEFAULT'] +cappilaryriseAlg = ['CRISE_HBV'] +lakeevapAlg = ['BASIC','LAKE_EVAP_BASIC'] +snowsqueezeAlg = ['SQUEEZE_RAVEN'] #:SnowSqueeze SQUEEZE_RAVEN SNOW_LIQ [state_var to_index] +glaciermeltAlg = ['GMELT_HBV','GMELT_UBC','GMELT_SIMPLE_MELT'] +glacierreleaseAlg = ['GRELEASE_HBV_EC','LINEAR_STORAGE','GRELEASE_LINEAR','GRELEASE_LINEAR_ANALYTIC'] +canopysublimationAlg = ['SUBLIM_ALL','SUBLIM_MAXIMUM','SUBLIM_SVERDRUP', + 'SUBLIM_KUZMIN','SUBLIM_CENTRAL_SIERRA','SUBLIM_PBSM', + 'SUBLIM_KUCHMENT_GELFAN','SUBLIM_BULK_AERO' + ] +overflowAlg = ['OVERFLOW_RAVEN','RAVEN_DEFAULT'] +snowalbedoevolveAlg = ['SNOALB_UBCWM','SNOALB_CRHM_ESSERY','SNOALB_BAKER'] +cropheatunitevAlg = ['CHU_ONTARIO'] +abstractionAlg = ['ABST_SCS','ABST_PERCENTAGE','ABST_FILL', + 'ABST_PDMROF','ABST_UWFS' + ] #:Abstraction [string method] PONDED_WATER DEPRESSION/MULTIPLE +glacierinfiltrationAlg = ["GINFIL_UBCWM"] +splitAlg = ['RAVEN_DEFAULT'] +convolutionAlg = ['CONVOL_GR4J_1','CONVOL_GR4J_2','CONVOL_GAMMA','CONVOL_GAMMA2'] +snowtempevolveAlg = ['SNOTEMP_NEWTONS'] +depresoverflowAlg = ['DFLOW_THRESHPOW','DFLOW_LINEAR','DFLOW_WEIR'] +exchangeflowAlg = ['RAVEN_DEFAULT']#:ExchangeFlow RAVEN_DEFAULT [state_var from] [state_var mixing_zone] +lateralflushAlg = ['RAVEN_DEFAULT'] #Interbasin +seepageAlg = ['SEEP_LINEAR'] +rechargeAlg = ['RECHARGE_CONSTANT','RECHARGE_FROMFILE','RAVEN_DEFAULT', + 'RECHARGE_CONSTANT_OVERLAP','RECHARGE_DATA','RECHARGE_FLUX' + ] #:Recharge RECHARGE_FROMFILE ATMOS_PRECIP SOIL[?] +blowingsnowAlg = ['PBSM'] #:BlowingSnow PBSM MULTIPLE MULTIPLE +lakereleaseAlg = ['LAKEREL_LINEAR'] +soilbalanceAlg = ['SOILBAL_SACSMA'] #:SoilBalance SOILBAL_SACSMA MULTIPLE MULTIPLE +lateralequilibrateAlg = ['RAVEN_DEFAULT'] #Interbasin + +#Lists of the compartments of each algorithm. Can easily add new compartments if new compartments are added in Raven +#Empty brackets = any soil or any convolution +fromPrecip = ["ATMOS_PRECIP","COLD_CONTENT", "SNOW_DEPTH"] +toPrecip = ["SNOW","PONDED_WATER","DEPRESSION","WETLAND","CANOPY","CANOPY_SNOW", + "SURFACE_WATER", "ATMOSPHERE","SNOW_LIQ","SNOW_DEFICIT","NEW_SNOW", + "COLD_CONTENT","SNOW_DEPTH","MULTIPLE",'' + ] +fromCanevp = ["CANOPY",''] +toCanevp = ["ATMOSPHERE",''] +fromCanopySublimation = ['CANOPY_SNOW',''] +toCanopySublimation = ['ATMOSPHERE',''] +fromSoilevap = ["SOIL[0]",'MULTIPLE',''] +toSoilevap = ["ATMOSPHERE",''] +toLakeevap = ["ATMOSPHERE",''] +fromOpenwaterevap = ["DEPRESSION",''] +toOpenwaterevap = ["ATMOSPHERE",''] +fromInfiltration = ["PONDED_WATER","MULTIPLE",''] +toInfiltration = ["SOIL[0]","SURFACE_WATER","MULTIPLE",''] +toInfiltUBC = ["SOIL[0]","SOIL[1]","SOIL[2]","SOIL[3]","SURFACE_WATER","MULTIPLE",''] +toInfiltHMETS = ["SOIL[0]","CONVOLUTION[0]","CONVOLUTION[1]",'MULTIPLE',''] +fromInfiltGAsimple = ["PONDED_WATER","GA_MOISTURE_INIT",''] +toInfiltGAsimple = ["SOIL[0]","SURFACE_WATER","GA_MOISTURE_INIT","MULTIPLE",''] +fromPercolation = [] +toPercolation = [] +fromCapillaryRise = [] +toCapillaryRise = [] +fromBaseflow = [] +toBaseflow = ['SURFACE_WATER',''] +fromRecharge = ['ATMOS_PRECIP',''] #Need to check for other algorithms +toRecharge = [] +fromSnowsqueeze = ["SNOW_LIQ",''] +toSnowsqueeze = [] +fromInterflow = [] +toInterflow = ['SURFACE_WATER',''] +fromSeepage = ['DEPRESSION',''] +toSeepage = [] +fromDepressOverflow = ['DEPRESSION',''] +toDepressOverflow = ['SURFACE_WATER',''] +fromLakeRelease = ['LAKE_STORAGE','SURFACE_WATER',''] #!!!! THIS ONE IS INCORRECT +toLakeRelease = ['SURFACE_WATER',''] +fromAbstraction = ['PONDED_WATER',''] +toAbstraction = ['DEPRESSION'] +toAbstractionPDMROF = ['DEPRESSION','SURFACE_WATER',''] +fromSnowmelt = ['SNOW',''] +toSnowmelt = ['PONDED_WATER',''] +fromSnowrefreeze = ['SNOW_LIQ',''] +fromSnowbalSimple = ['SNOW',''] +toSnowbalSimple = ['PONDED_WATER','SNOW_LIQ',''] +fromSnowbalColdcontent = ['SNOW','SNOW_LIQ',"COLD_CONTENT","ENERGY_LOSSES","MULTIPLE",''] +toSnowbalColdcontent = ['SNOW','SNOW_LIQ','SURFACE_WATER',"COLD_CONTENT","ENERGY_LOSSES","MULTIPLE",''] +fromSnowbalHBV = ['SNOW','SNOW_LIQ',"MULTIPLE",''] +toSnowbalHBV = ['SNOW_LIQ','SOIL[0]',"MULTIPLE",''] +fromSnowbaltwolayer = ['NEW_SNOW','PONDED_WATER','SNOW','SNOW_LIQ[0]','SNOW_LIQ[1]','COLD_CONTENT[0]','COLD_CONTENT[1]','SNOW_TEMP','CUM_SNOWMELT',"MULTIPLE",''] +toSnowbaltwolayer = ['SNOW','SNOW_LIQ[0]','SNOW_LIQ[1]','PONDED_WATER','COLD_CONTENT[0]','COLD_CONTENT[1]','SNOW_TEMP','CUM_SNOWMELT',"MULTIPLE",''] +fromSnowbalCema = ['SNOW','SNOW_COVER',"MULTIPLE",''] +toSnowbalCema = ['PONDED_WATER','SNOW_COVER',"MULTIPLE",''] +fromSnowbalGawser = ['SNOW','SNOW_LIQ','COLD_CONTENT',"MULTIPLE",''] +toSnowbalGawser = ['SNOW','SNOW_LIQ','COLD_CONTENT','PONDED_WATER',"MULTIPLE",''] +fromSnowbalUBCWM = ['SNOW','SNOW_LIQ','COLD_CONTENT','SNOW_COVER','CUM_SNOWMELT','SNOW_DEFICIT','MULTIPLE',''] +toSnowbalUBCWM = ['SNOW','SNOW_LIQ','PONDED_WATER','COLD_CONTENT','SNOW_COVER','CUM_SNOWMELT','SNOW_DEFICIT','MULTIPLE',''] +fromSnowbalHMETS = ['SNOW','SNOW_LIQ','CUM_SNOWMELT','MULTIPLE',''] +toSnowbalHMETS = ['SNOW_LIQ','MULTIPLE',''] +fromSnowbalCRHM = ['SNOW','SNOW_LIQ','COLD_CONTENT',"MULTIPLE",''] +toSnowbalCRHM = ['SNOW','SNOW_LIQ','CUM_SNOWMELT','PONDED_WATER',"MULTIPLE",''] +fromSnowtempEvolve = ['SNOW_TEMP',''] +toSnowtempEvolve = ['SNOW_TEMP',''] +fromBlowingsnow = ['SNOW','SNOW_AGE','SNOW_DEPTH','SNODRIFT_TEMP','SNOW_LIQ',''] +toBlowingsnow = ['SNOW_AGE','SNOW_DEPTH','SNOW_DRIFT','SNODRIFT_TEMP','ATMOSPHERE',''] +fromSublimation = ['SNOW',''] +toSublimation = ['ATMOSPHERE',''] +fromSnowalbevo = ['SNOW_ALBEDO',''] +toSnowalbevo = ['SNOW_ALBEDO',''] +fromSnowalbevoBaker = ['SNOW_ALBEDO','SNOW_AGE',''] +toSnowalbevoBaker = ['SNOW_ALBEDO','SNOW_AGE',''] +fromCanopydrip = ['CANOPY',''] +toCanopydrip = ['PONDED_WATER',''] +fromGlaciermelt = ['GLACIER_ICE',''] +toGlaciermelt = ['GLACIER',''] +toGlaciermeltUBC = ['GLACIER','PONDED_WATER',''] #Ponded water is not in the .dat file, but is in the template and raven source code +fromGlacierInfiltration = ['PONDED_WATER',''] +toGlacierInfiltration = ['GLACIER','SOIL[2]','SOIL[3]','MULTIPLE',''] +fromGlacierRelease = ['GLACIER',''] +toGlacierRelease = ['SURFACE_WATER',''] +fromExchangeflow = [] +toExchangeflow = [] +fromConvolution = [] +fromCropheatunit = ['CROP_HEAT_UNIT',''] +toCropheatunit = ['CROP_HEAT_UNIT',''] +statevariables = ['SURFACE_WATER','ATMOSPHERE','ATMOS_PRECIP','PONDED_WATER','SOIL','GROUNDWATER', + 'CANOPY','CANOPY_SNOW','TRUNK','ROOT','DEPRESSION','WETLAND','LAKE_STORAGE','SNOW', + 'SNOW_LIQ','GLACIER','GLACIER_ICE'] +statevariables.sort() + +anyCompartment = list(set().union( + fromPrecip,toPrecip,fromCanevp,toCanevp,fromSoilevap,toSoilevap, + toLakeevap,fromOpenwaterevap,toOpenwaterevap,fromInfiltration,toInfiltration, + toInfiltUBC,toInfiltHMETS,fromInfiltGAsimple,toInfiltGAsimple,toBaseflow,fromRecharge, + fromSnowsqueeze,toInterflow,fromSeepage,fromDepressOverflow,toDepressOverflow, + fromLakeRelease,toLakeRelease,fromAbstraction,toAbstraction,toAbstractionPDMROF,fromSnowmelt, + toSnowmelt,fromSnowrefreeze,fromSnowbalSimple,toSnowbalSimple,fromSnowbalColdcontent,toSnowbalColdcontent, + fromSnowbalHBV,toSnowbalHBV,fromSnowbaltwolayer,toSnowbaltwolayer,fromSnowbalCema, + toSnowbalCema,fromSnowbalGawser,toSnowbalGawser,fromSnowbalUBCWM,toSnowbalUBCWM,fromSnowbalHMETS, + toSnowbalHMETS,fromSnowbalCRHM,toSnowbalCRHM,fromSnowtempEvolve,toSnowtempEvolve, + fromBlowingsnow,toBlowingsnow,fromSublimation,toSublimation,fromSnowalbevo,toSnowalbevo, + fromSnowalbevoBaker,toSnowalbevoBaker,fromCanopydrip,toCanopydrip,fromGlaciermelt,toGlaciermelt, + fromGlacierInfiltration,toGlacierInfiltration,fromGlacierRelease,toGlacierRelease, + fromCropheatunit,toCropheatunit + )) \ No newline at end of file diff --git a/qraven/modules/resetgui.py b/qraven/modules/resetgui.py index 7d3ad79..4cda8c9 100644 --- a/qraven/modules/resetgui.py +++ b/qraven/modules/resetgui.py @@ -1,5 +1,6 @@ +from PyQt5.QtCore import QDateTime #This method reset the RVI section to the default values -def resetGUI(self): +def partialReset(self): table = self.dlg.table_hydroprocess #Get the hydrological processes table #Deletes all the table rows while(table.rowCount()>0): @@ -24,6 +25,7 @@ def resetGUI(self): self.dlg.combo_monthlyinterpo.setCurrentText("") self.dlg.combo_lakestorage.setCurrentText("") self.dlg.txt_interpofile.clear() + self.dlg.txt_interpofile.setEnabled(False) self.dlg.combo_swradation.setCurrentText("") self.dlg.combo_swcanopy.setCurrentText("") self.dlg.combo_swcloud.setCurrentText("") @@ -37,4 +39,69 @@ def resetGUI(self): self.dlg.chk_directevapo.setChecked(False) self.dlg.chk_snowsuppressespet.setChecked(False) self.dlg.chk_suppresscomppet.setChecked(False) - self.dlg.chk_snaphydro.setChecked(False) \ No newline at end of file + self.dlg.chk_snaphydro.setChecked(False) + +def fullReset(self): + partialReset(self) + self.dlg.file_rvioutputdir.setFilePath('') + self.dlg.txt_modname.clear() + time = QDateTime.fromString('2000/01/01 00:00:00', 'yyyy/MM/dd hh:mm:ss') + self.dlg.date_startdate.setDateTime(time) + self.dlg.date_enddate.setDateTime(time) + self.dlg.chk_duration.setCheckState(False) + self.dlg.spin_duration.setValue(0) + self.dlg.spin_timestep_h.setValue(0) + self.dlg.spin_timestep_m.setValue(0) + self.dlg.spin_timestep_s.setValue(0) + self.dlg.txt_defhru.clear() + self.dlg.chk_disablehru.setCheckState(False) + self.dlg.txt_disablehru.clear() + self.dlg.chk_chunksize.setCheckState(False) + self.dlg.spin_chunksize.setValue(0) + self.dlg.chk_outputdir.setCheckState(False) + self.dlg.file_outputdir.setFilePath('') + self.dlg.chk_outputdump.setCheckState(False) + self.dlg.date_outputdump.setDateTime(time) + self.dlg.chk_outputinterval.setCheckState(False) + self.dlg.spin_outinterval.setValue(0.00) + self.dlg.chk_readlivefile.setCheckState(False) + self.dlg.spin_readlivefile.setValue(0) + self.dlg.chk_reservoirdemandalloc.setCheckState(False) + self.dlg.chk_runname.setCheckState(False) + self.dlg.txt_runname.clear() + self.dlg.chk_rvcfilename.setCheckState(False) + self.dlg.txt_rvcfilename.clear() + self.dlg.chk_rvhfilename.setCheckState(False) + self.dlg.txt_rvhfilename.clear() + self.dlg.chk_rvpfilename.setCheckState(False) + self.dlg.txt_rvpfilename.clear() + self.dlg.chk_rvtfilename.setCheckState(False) + self.dlg.txt_rvtfilename.clear() + self.dlg.chk_wateryear.setCheckState(False) + self.dlg.spin_wateryear.setValue(1) + self.dlg.chk_assimilatestreamflow.setCheckState(False) + self.dlg.chk_silentmode.setCheckState(False) + self.dlg.chk_writeensim.setCheckState(False) + self.dlg.chk_assimilatereservstage.setCheckState(False) + self.dlg.chk_suppressoutput.setCheckState(False) + self.dlg.chk_writeexausmb.setCheckState(False) + self.dlg.chk_rvptemplate.setCheckState(False) + self.dlg.chk_snaphydro.setCheckState(False) + self.dlg.chk_writeforcingfunc.setCheckState(False) + self.dlg.chk_debugmode.setCheckState(False) + self.dlg.chk_usestopfile.setCheckState(False) + self.dlg.chk_writemassbal.setCheckState(False) + self.dlg.chk_endpause.setCheckState(False) + self.dlg.chk_writedemand.setCheckState(False) + self.dlg.chk_writemassloadings.setCheckState(False) + self.dlg.chk_noisymode.setCheckState(False) + self.dlg.chk_writeenergy.setCheckState(False) + self.dlg.list_evalmetrics.clearSelection() + transportTable = self.dlg.table_transport + while(transportTable.rowCount()>0): + transportTable.removeRow(0) + customoutputs = self.dlg.table_customoutputs + while(customoutputs.rowCount()>0): + customoutputs.removeRow(0) + + diff --git a/qraven/modules/templates/.DS_Store b/qraven/modules/templates/.DS_Store deleted file mode 100644 index 3df702e..0000000 Binary files a/qraven/modules/templates/.DS_Store and /dev/null differ diff --git a/qraven/modules/templates/__pycache__/gr4j.cpython-39.pyc b/qraven/modules/templates/__pycache__/gr4j.cpython-39.pyc deleted file mode 100644 index 13cb6e0..0000000 Binary files a/qraven/modules/templates/__pycache__/gr4j.cpython-39.pyc and /dev/null differ diff --git a/qraven/modules/templates/__pycache__/hbvec.cpython-39.pyc b/qraven/modules/templates/__pycache__/hbvec.cpython-39.pyc deleted file mode 100644 index ba4a6e3..0000000 Binary files a/qraven/modules/templates/__pycache__/hbvec.cpython-39.pyc and /dev/null differ diff --git a/qraven/modules/templates/__pycache__/hmets.cpython-39.pyc b/qraven/modules/templates/__pycache__/hmets.cpython-39.pyc deleted file mode 100644 index 42bfee9..0000000 Binary files a/qraven/modules/templates/__pycache__/hmets.cpython-39.pyc and /dev/null differ diff --git a/qraven/modules/templates/__pycache__/ubcwm.cpython-39.pyc b/qraven/modules/templates/__pycache__/ubcwm.cpython-39.pyc deleted file mode 100644 index 24a961e..0000000 Binary files a/qraven/modules/templates/__pycache__/ubcwm.cpython-39.pyc and /dev/null differ diff --git a/qraven/modules/templates/awbm.py b/qraven/modules/templates/awbm.py new file mode 100644 index 0000000..110ee29 --- /dev/null +++ b/qraven/modules/templates/awbm.py @@ -0,0 +1,79 @@ +from ..hydrologicproc import addprocess +#This method loads a AWBM template into the GUI +def loadAwbm(self): + try: + table = self.dlg.table_hydroprocess #Get the hydrological processes table + + #Sets the model parameters + self.dlg.combo_method.setCurrentText("ORDERED_SERIES") + self.dlg.combo_routing.setCurrentText("ROUTE_NONE") + self.dlg.combo_catchment.setCurrentText("ROUTE_DUMP") + + self.dlg.combo_evapo.setCurrentText("PET_HAMON") + self.dlg.combo_rainsnowfrac.setCurrentText("RAINSNOW_THRESHOLD") + self.dlg.combo_potentialmelt.setCurrentText("POTMELT_DEGREE_DAY") + self.dlg.combo_precipicept.setCurrentText("PRECIP_ICEPT_NONE") + self.dlg.combo_cloudcover.setCurrentText("CLOUDCOV_NONE") + self.dlg.combo_lwradation.setCurrentText("LW_RAD_NONE") + self.dlg.combo_swradation.setCurrentText("SW_RAD_NONE") + + self.dlg.combo_soilmod.setCurrentText("SOIL_MULTILAYER") + self.dlg.spin_soilmod.setValue(4) + + #Sets the hydrological processes + for i in range(5): + addprocess(self) + + combo_proc = table.cellWidget(0,0) + combo_proc.setCurrentText("Precipitation") + combo_alg = table.cellWidget(0,1) + combo_alg.setCurrentText("PRECIP_RAVEN") + combo_from = table.cellWidget(0,2) + combo_from.setCurrentText("ATMOS_PRECIP") + combo_to = table.cellWidget(0,4) + combo_to.setCurrentText("MULTIPLE") + + combo_proc = table.cellWidget(1,0) + combo_proc.setCurrentText("SnowBalance") + combo_alg = table.cellWidget(1,1) + combo_alg.setCurrentText("SNOBAL_SIMPLE_MELT") + combo_from = table.cellWidget(1,2) + combo_from.setCurrentText("SNOW") + combo_to = table.cellWidget(1,4) + combo_to.setCurrentText("PONDED_WATER") + + combo_proc = table.cellWidget(2,0) + combo_proc.setCurrentText("Infiltration") + combo_alg = table.cellWidget(2,1) + combo_alg.setCurrentText("INF_AWBM") + combo_from = table.cellWidget(2,2) + combo_from.setCurrentText("PONDED_WATER") + combo_to = table.cellWidget(2,4) + combo_to.setCurrentText("MULTIPLE") + + combo_proc = table.cellWidget(3,0) + combo_proc.setCurrentText("SoilEvaporation") + combo_alg = table.cellWidget(3,1) + combo_alg.setCurrentText("SOILEVAP_AWBM") + combo_from = table.cellWidget(3,2) + combo_from.setCurrentText("MULTIPLE") + combo_to = table.cellWidget(3,4) + combo_to.setCurrentText("ATMOSPHERE") + + combo_proc = table.cellWidget(4,0) + combo_proc.setCurrentText("Baseflow") + combo_alg = table.cellWidget(4,1) + combo_alg.setCurrentText("BASE_LINEAR") + combo_from = table.cellWidget(4,2) + combo_from.setCurrentText("SOIL[3]") + combo_to = table.cellWidget(4,4) + combo_to.setCurrentText("SURFACE_WATER") + + + table.resizeColumnsToContents() #Resizes the width of the column automatically + + print("AWBM template loaded.") + self.iface.messageBar().pushSuccess("Success", "Loaded AWBM template successfully") + except Exception as e: + print('An error occured while loading AWBM template.') + print(e) \ No newline at end of file diff --git a/qraven/modules/templates/canshield.py b/qraven/modules/templates/canshield.py index 57b642c..513c371 100644 --- a/qraven/modules/templates/canshield.py +++ b/qraven/modules/templates/canshield.py @@ -1,3 +1,4 @@ +from ..hydrologicproc import addprocess #This method loads a GR4J template into the GUI def loadCanshield(self): try: @@ -22,7 +23,7 @@ def loadCanshield(self): #Sets the hydrological processes for i in range(15): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("SnowRefreeze") @@ -30,7 +31,7 @@ def loadCanshield(self): combo_alg.setCurrentText("FREEZE_DEGREE_DAY") combo_from = table.cellWidget(0,2) combo_from.setCurrentText("SNOW_LIQ") - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText("SNOW") combo_proc = table.cellWidget(1,0) @@ -39,7 +40,7 @@ def loadCanshield(self): combo_alg.setCurrentText("PRECIP_RAVEN") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(1,3) + combo_to = table.cellWidget(1,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(2,0) @@ -48,7 +49,7 @@ def loadCanshield(self): combo_alg.setCurrentText("CANEVP_MAXIMUM") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("CANOPY") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(3,0) @@ -57,7 +58,7 @@ def loadCanshield(self): combo_alg.setCurrentText("SUBLIM_MAXIMUM") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("CANOPY_SNOW") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(4,0) @@ -66,7 +67,7 @@ def loadCanshield(self): combo_alg.setCurrentText("SNOBAL_TWO_LAYER") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("MULTIPLE") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(5,0) @@ -75,7 +76,7 @@ def loadCanshield(self): combo_alg.setCurrentText("ABST_FILL") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("DEPRESSION") combo_proc = table.cellWidget(6,0) @@ -84,7 +85,7 @@ def loadCanshield(self): combo_alg.setCurrentText("OPEN_WATER_EVAP") combo_from = table.cellWidget(6,2) combo_from.setCurrentText("DEPRESSION") - combo_to = table.cellWidget(6,3) + combo_to = table.cellWidget(6,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(7,0) @@ -93,7 +94,7 @@ def loadCanshield(self): combo_alg.setCurrentText("INF_HBV") combo_from = table.cellWidget(7,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(7,3) + combo_to = table.cellWidget(7,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(8,0) @@ -102,7 +103,7 @@ def loadCanshield(self): combo_alg.setCurrentText("LAKEREL_LINEAR") combo_from = table.cellWidget(8,2) combo_from.setCurrentText("LAKE_STORAGE") - combo_to = table.cellWidget(8,3) + combo_to = table.cellWidget(8,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(9,0) @@ -111,7 +112,7 @@ def loadCanshield(self): combo_alg.setCurrentText("SOILEVAP_ROOT") combo_from = table.cellWidget(9,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(9,3) + combo_to = table.cellWidget(9,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(10,0) @@ -120,7 +121,7 @@ def loadCanshield(self): combo_alg.setCurrentText("PERC_GAWSER_CONSTRAIN") combo_from = table.cellWidget(10,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(10,3) + combo_to = table.cellWidget(10,4) combo_to.setCurrentText("SOIL[1]") combo_proc = table.cellWidget(11,0) @@ -129,7 +130,7 @@ def loadCanshield(self): combo_alg.setCurrentText("PERC_GAWSER_CONSTRAIN") combo_from = table.cellWidget(11,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(11,3) + combo_to = table.cellWidget(11,4) combo_to.setCurrentText("SOIL[2]") combo_proc = table.cellWidget(12,0) @@ -138,7 +139,7 @@ def loadCanshield(self): combo_alg.setCurrentText("BASE_THRESH_POWER") combo_from = table.cellWidget(12,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(12,3) + combo_to = table.cellWidget(12,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(13,0) @@ -147,7 +148,7 @@ def loadCanshield(self): combo_alg.setCurrentText("BASE_THRESH_POWER") combo_from = table.cellWidget(13,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(13,3) + combo_to = table.cellWidget(13,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(14,0) @@ -156,7 +157,7 @@ def loadCanshield(self): combo_alg.setCurrentText("BASE_THRESH_POWER") combo_from = table.cellWidget(14,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(14,3) + combo_to = table.cellWidget(14,4) combo_to.setCurrentText("SURFACE_WATER") table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/modules/templates/gr4j.py b/qraven/modules/templates/gr4j.py index 2d1ec9b..25e31c1 100644 --- a/qraven/modules/templates/gr4j.py +++ b/qraven/modules/templates/gr4j.py @@ -1,3 +1,5 @@ +from ..hydrologicproc import addprocess + #This method loads a GR4J template into the GUI def loadGr4j(self): try: @@ -20,7 +22,7 @@ def loadGr4j(self): #Sets the hydrological processes for i in range(15): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("Precipitation") @@ -28,7 +30,7 @@ def loadGr4j(self): combo_alg.setCurrentText("PRECIP_RAVEN") combo_from = table.cellWidget(0,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(1,0) @@ -37,6 +39,8 @@ def loadGr4j(self): combo_alg.setCurrentText("SNOTEMP_NEWTONS") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("SNOW_TEMP") + combo_from = table.cellWidget(1,4) + combo_from.setCurrentText("") combo_proc = table.cellWidget(2,0) combo_proc.setCurrentText("SnowBalance") @@ -44,7 +48,7 @@ def loadGr4j(self): combo_alg.setCurrentText("SNOBAL_CEMA_NEIGE") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("SNOW") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("PONDED_WATER") combo_proc = table.cellWidget(3,0) @@ -53,7 +57,7 @@ def loadGr4j(self): combo_alg.setCurrentText("OPEN_WATER_EVAP") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(4,0) @@ -62,7 +66,7 @@ def loadGr4j(self): combo_alg.setCurrentText("INF_GR4J") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(5,0) @@ -71,7 +75,7 @@ def loadGr4j(self): combo_alg.setCurrentText("SOILEVAP_GR4J") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(6,0) @@ -80,7 +84,7 @@ def loadGr4j(self): combo_alg.setCurrentText("PERC_GR4J") combo_from = table.cellWidget(6,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(6,3) + combo_to = table.cellWidget(6,4) combo_to.setCurrentText("SOIL[2]") combo_proc = table.cellWidget(7,0) @@ -89,18 +93,23 @@ def loadGr4j(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(7,2) combo_from.setCurrentText("SURFACE_WATER") - combo_to = table.cellWidget(7,3) + combo_to = table.cellWidget(7,4) combo_to.setCurrentText("SOIL[2]") - #NEED MODIFICATION IN GUI TO SUPPORT SPLIT COMMAND combo_proc = table.cellWidget(8,0) combo_proc.setCurrentText("Split") combo_alg = table.cellWidget(8,1) combo_alg.setCurrentText("RAVEN_DEFAULT") - # combo_from = table.cellWidget(8,2) - # combo_from.setCurrentText("PONDED_WATER") - # combo_to = table.cellWidget(8,3) - # combo_to.setCurrentText("MULTIPLE") + combo_from = table.cellWidget(8,2) + combo_from.setCurrentText("SOIL[2]") + combo_to = table.cellWidget(8,4) + combo_to.setCurrentText("CONVOLUTION[0]") + combo_to2 = table.cellWidget(8,5) + combo_to2.setCurrentText("CONVOLUTION[1]") + chk_mixingrate = table.cellWidget(8,10) + chk_mixingrate.setChecked(True) + spin_pct = table.cellWidget(8,11) + spin_pct.setValue(0.9) combo_proc = table.cellWidget(9,0) combo_proc.setCurrentText("Convolve") @@ -108,7 +117,7 @@ def loadGr4j(self): combo_alg.setCurrentText("CONVOL_GR4J_1") combo_from = table.cellWidget(9,2) combo_from.setCurrentText("CONVOLUTION[0]") - combo_to = table.cellWidget(9,3) + combo_to = table.cellWidget(9,4) combo_to.setCurrentText("SOIL[1]") combo_proc = table.cellWidget(10,0) @@ -117,7 +126,7 @@ def loadGr4j(self): combo_alg.setCurrentText("CONVOL_GR4J_2") combo_from = table.cellWidget(10,2) combo_from.setCurrentText("CONVOLUTION[1]") - combo_to = table.cellWidget(10,3) + combo_to = table.cellWidget(10,4) combo_to.setCurrentText("SOIL[2]") combo_proc = table.cellWidget(11,0) @@ -126,7 +135,7 @@ def loadGr4j(self): combo_alg.setCurrentText("PERC_GR4JEXCH") combo_from = table.cellWidget(11,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(11,3) + combo_to = table.cellWidget(11,4) combo_to.setCurrentText("SOIL[3]") combo_proc = table.cellWidget(12,0) @@ -135,7 +144,7 @@ def loadGr4j(self): combo_alg.setCurrentText("PERC_GR4JEXCH2") combo_from = table.cellWidget(12,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(12,3) + combo_to = table.cellWidget(12,4) combo_to.setCurrentText("SOIL[3]") combo_proc = table.cellWidget(13,0) @@ -144,7 +153,7 @@ def loadGr4j(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(13,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(13,3) + combo_to = table.cellWidget(13,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(14,0) @@ -153,7 +162,7 @@ def loadGr4j(self): combo_alg.setCurrentText("BASE_GR4J") combo_from = table.cellWidget(14,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(14,3) + combo_to = table.cellWidget(14,4) combo_to.setCurrentText("SURFACE_WATER") table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/modules/templates/hbvec.py b/qraven/modules/templates/hbvec.py index e0b9808..c933858 100644 --- a/qraven/modules/templates/hbvec.py +++ b/qraven/modules/templates/hbvec.py @@ -1,3 +1,5 @@ +from ..hydrologicproc import addprocess + #This method loads a template of HBV-EC into the GUI def loadHbvec(self): try: @@ -20,7 +22,6 @@ def loadHbvec(self): self.dlg.combo_oroprecip.setCurrentText("OROCORR_HBV") self.dlg.combo_oropet.setCurrentText("OROCORR_HBV") self.dlg.combo_cloudcover.setCurrentText("CLOUDCOV_NONE") - self.dlg.combo_soilmod.setCurrentText("SOIL_TWO_LAYER") self.dlg.combo_precipicept.setCurrentText("PRECIP_ICEPT_USER") self.dlg.combo_monthlyinterpo.setCurrentText("MONTHINT_LINEAR_21") #NEED TO SET THE LAKESTORAGE PROPERLY!!!! @@ -30,7 +31,7 @@ def loadHbvec(self): #Sets the hydrological processes for i in range(21): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("SnowRefreeze") @@ -38,7 +39,7 @@ def loadHbvec(self): combo_alg.setCurrentText("FREEZE_DEGREE_DAY") combo_from = table.cellWidget(0,2) combo_from.setCurrentText("SNOW_LIQ") - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText("SNOW") combo_proc = table.cellWidget(1,0) @@ -47,7 +48,7 @@ def loadHbvec(self): combo_alg.setCurrentText("PRECIP_RAVEN") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(1,3) + combo_to = table.cellWidget(1,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(2,0) @@ -56,7 +57,7 @@ def loadHbvec(self): combo_alg.setCurrentText("CANEVP_ALL") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("CANOPY") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(3,0) @@ -65,7 +66,7 @@ def loadHbvec(self): combo_alg.setCurrentText("SUBLIM_ALL") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("CANOPY_SNOW") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(4,0) @@ -74,7 +75,7 @@ def loadHbvec(self): combo_alg.setCurrentText("SNOBAL_SIMPLE_MELT") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("SNOW") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("SNOW_LIQ") combo_proc = table.cellWidget(5,0) @@ -83,7 +84,7 @@ def loadHbvec(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("SNOW_LIQ") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("PONDED_WATER") combo_proc = table.cellWidget(6,0) @@ -92,15 +93,15 @@ def loadHbvec(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(6,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(6,3) + combo_to = table.cellWidget(6,4) combo_to.setCurrentText("GLACIER") - checkconditional = table.cellWidget(6,4) + checkconditional = table.cellWidget(6,6) checkconditional.setChecked(True) - combo_basedtype = table.cellWidget(6,5) + combo_basedtype = table.cellWidget(6,7) combo_basedtype.setCurrentText("HRU_TYPE") - combo_comparison = table.cellWidget(6,6) + combo_comparison = table.cellWidget(6,8) combo_comparison.setCurrentText("IS") - txt_hrutype = table.cellWidget(6,7) + txt_hrutype = table.cellWidget(6,9) txt_hrutype.setText("GLACIER") combo_proc = table.cellWidget(7,0) @@ -109,7 +110,7 @@ def loadHbvec(self): combo_alg.setCurrentText("GMELT_HBV") combo_from = table.cellWidget(7,2) combo_from.setCurrentText("GLACIER_ICE") - combo_to = table.cellWidget(7,3) + combo_to = table.cellWidget(7,4) combo_to.setCurrentText("GLACIER") combo_proc = table.cellWidget(8,0) @@ -118,7 +119,7 @@ def loadHbvec(self): combo_alg.setCurrentText("GRELEASE_HBV_EC") combo_from = table.cellWidget(8,2) combo_from.setCurrentText("GLACIER") - combo_to = table.cellWidget(8,3) + combo_to = table.cellWidget(8,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(9,0) @@ -127,7 +128,7 @@ def loadHbvec(self): combo_alg.setCurrentText("INF_HBV") combo_from = table.cellWidget(9,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(9,3) + combo_to = table.cellWidget(9,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(10,0) @@ -136,15 +137,15 @@ def loadHbvec(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(10,2) combo_from.setCurrentText("SURFACE_WATER") - combo_to = table.cellWidget(10,3) + combo_to = table.cellWidget(10,4) combo_to.setCurrentText("SOIL[1]") - checkconditional = table.cellWidget(10,4) + checkconditional = table.cellWidget(10,6) checkconditional.setChecked(True) - combo_basedtype = table.cellWidget(10,5) + combo_basedtype = table.cellWidget(10,7) combo_basedtype.setCurrentText("HRU_TYPE") - combo_comparison = table.cellWidget(10,6) + combo_comparison = table.cellWidget(10,8) combo_comparison.setCurrentText("IS_NOT") - txt_hrutype = table.cellWidget(10,7) + txt_hrutype = table.cellWidget(10,9) txt_hrutype.setText("GLACIER") combo_proc = table.cellWidget(11,0) @@ -153,15 +154,15 @@ def loadHbvec(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(11,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(11,3) + combo_to = table.cellWidget(11,4) combo_to.setCurrentText("SURFACE_WATER") - checkconditional = table.cellWidget(11,4) + checkconditional = table.cellWidget(11,6) checkconditional.setChecked(True) - combo_basedtype = table.cellWidget(11,5) + combo_basedtype = table.cellWidget(11,7) combo_basedtype.setCurrentText("HRU_TYPE") - combo_comparison = table.cellWidget(11,6) + combo_comparison = table.cellWidget(11,8) combo_comparison.setCurrentText("IS") - txt_hrutype = table.cellWidget(11,7) + txt_hrutype = table.cellWidget(11,9) txt_hrutype.setText("LAKE") combo_proc = table.cellWidget(12,0) @@ -170,7 +171,7 @@ def loadHbvec(self): combo_alg.setCurrentText("SOILEVAP_HBV") combo_from = table.cellWidget(12,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(12,3) + combo_to = table.cellWidget(12,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(13,0) @@ -179,7 +180,7 @@ def loadHbvec(self): combo_alg.setCurrentText("CRISE_HBV") combo_from = table.cellWidget(13,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(13,3) + combo_to = table.cellWidget(13,4) combo_to.setCurrentText("SOIL[0]") combo_proc = table.cellWidget(14,0) @@ -188,7 +189,7 @@ def loadHbvec(self): combo_alg.setCurrentText("LAKE_EVAP_BASIC") combo_from = table.cellWidget(14,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(14,3) + combo_to = table.cellWidget(14,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(15,0) @@ -197,7 +198,7 @@ def loadHbvec(self): combo_alg.setCurrentText("SOILEVAP_HBV") combo_from = table.cellWidget(15,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(15,3) + combo_to = table.cellWidget(15,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(16,0) @@ -206,7 +207,7 @@ def loadHbvec(self): combo_alg.setCurrentText("PERC_CONSTANT") combo_from = table.cellWidget(16,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(16,3) + combo_to = table.cellWidget(16,4) combo_to.setCurrentText("SOIL[2]") combo_proc = table.cellWidget(17,0) @@ -215,7 +216,7 @@ def loadHbvec(self): combo_alg.setCurrentText("BASE_POWER_LAW") combo_from = table.cellWidget(17,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(17,3) + combo_to = table.cellWidget(17,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(18,0) @@ -224,7 +225,7 @@ def loadHbvec(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(18,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(18,3) + combo_to = table.cellWidget(18,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(19,0) @@ -233,9 +234,9 @@ def loadHbvec(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(19,2) combo_from.setCurrentText("AllHRUs") - combo_to = table.cellWidget(19,3) + combo_to = table.cellWidget(19,4) combo_to.setCurrentText("SOIL[1]") - spin_pct = table.cellWidget(19,9) + spin_pct = table.cellWidget(19,11) spin_pct.setValue(1.0) combo_proc = table.cellWidget(20,0) @@ -244,9 +245,9 @@ def loadHbvec(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(20,2) combo_from.setCurrentText("AllHRUs") - combo_to = table.cellWidget(20,3) + combo_to = table.cellWidget(20,4) combo_to.setCurrentText("SOIL[2]") - spin_pct = table.cellWidget(20,9) + spin_pct = table.cellWidget(20,11) spin_pct.setValue(1.0) table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/modules/templates/hbvlight.py b/qraven/modules/templates/hbvlight.py new file mode 100644 index 0000000..c2eda17 --- /dev/null +++ b/qraven/modules/templates/hbvlight.py @@ -0,0 +1,142 @@ +from ..hydrologicproc import addprocess + +#This method loads a template of HBV-Light into the GUI +def loadHbvlight(self): + try: + table = self.dlg.table_hydroprocess #Get the hydrological processes table + + #Sets the model parameters + self.dlg.combo_method.setCurrentText("ORDERED_SERIES") + self.dlg.combo_routing.setCurrentText("ROUTE_NONE") + self.dlg.combo_catchment.setCurrentText("ROUTE_TRI_CONVOLUTION") + self.dlg.combo_evapo.setCurrentText("PET_DATA") + self.dlg.combo_rainsnowfrac.setCurrentText("RAINSNOW_HBV") + self.dlg.combo_potentialmelt.setCurrentText("POTMELT_DEGREE_DAY") + self.dlg.combo_orotemp.setCurrentText("OROCORR_HBV") + self.dlg.combo_oroprecip.setCurrentText("OROCORR_HBV") + self.dlg.combo_oropet.setCurrentText("OROCORR_HBV") + self.dlg.combo_cloudcover.setCurrentText("CLOUDCOV_NONE") + self.dlg.combo_precipicept.setCurrentText("PRECIP_ICEPT_USER") + + self.dlg.combo_soilmod.setCurrentText("SOIL_MULTILAYER") + self.dlg.spin_soilmod.setValue(3) + + #Sets the hydrological processes + for i in range(12): + addprocess(self) + + combo_proc = table.cellWidget(0,0) + combo_proc.setCurrentText("SnowRefreeze") + combo_alg = table.cellWidget(0,1) + combo_alg.setCurrentText("FREEZE_DEGREE_DAY") + combo_from = table.cellWidget(0,2) + combo_from.setCurrentText("SNOW_LIQ") + combo_to = table.cellWidget(0,4) + combo_to.setCurrentText("SNOW") + + combo_proc = table.cellWidget(1,0) + combo_proc.setCurrentText("Precipitation") + combo_alg = table.cellWidget(1,1) + combo_alg.setCurrentText("PRECIP_RAVEN") + combo_from = table.cellWidget(1,2) + combo_from.setCurrentText("ATMOS_PRECIP") + combo_to = table.cellWidget(1,4) + combo_to.setCurrentText("MULTIPLE") + + combo_proc = table.cellWidget(2,0) + combo_proc.setCurrentText("SnowBalance") + combo_alg = table.cellWidget(2,1) + combo_alg.setCurrentText("SNOBAL_SIMPLE_MELT") + combo_from = table.cellWidget(2,2) + combo_from.setCurrentText("SNOW") + combo_to = table.cellWidget(2,4) + combo_to.setCurrentText("SNOW_LIQ") + + combo_proc = table.cellWidget(3,0) + combo_proc.setCurrentText("Overflow") + combo_alg = table.cellWidget(3,1) + combo_alg.setCurrentText("RAVEN_DEFAULT") + combo_from = table.cellWidget(3,2) + combo_from.setCurrentText("SNOW_LIQ") + combo_to = table.cellWidget(3,4) + combo_to.setCurrentText("PONDED_WATER") + + combo_proc = table.cellWidget(4,0) + combo_proc.setCurrentText("Infiltration") + combo_alg = table.cellWidget(4,1) + combo_alg.setCurrentText("INF_HBV") + combo_from = table.cellWidget(4,2) + combo_from.setCurrentText("PONDED_WATER") + combo_to = table.cellWidget(4,4) + combo_to.setCurrentText("MULTIPLE") + + combo_proc = table.cellWidget(5,0) + combo_proc.setCurrentText("Flush") + combo_alg = table.cellWidget(5,1) + combo_alg.setCurrentText("RAVEN_DEFAULT") + combo_from = table.cellWidget(5,2) + combo_from.setCurrentText("SURFACE_WATER") + combo_to = table.cellWidget(5,4) + combo_to.setCurrentText("SOIL[1]") + + combo_proc = table.cellWidget(6,0) + combo_proc.setCurrentText("SoilEvaporation") + combo_alg = table.cellWidget(6,1) + combo_alg.setCurrentText("SOILEVAP_HBV") + combo_from = table.cellWidget(6,2) + combo_from.setCurrentText("SOIL[0]") + combo_to = table.cellWidget(6,4) + combo_to.setCurrentText("ATMOSPHERE") + + combo_proc = table.cellWidget(7,0) + combo_proc.setCurrentText("CapillaryRise") + combo_alg = table.cellWidget(7,1) + combo_alg.setCurrentText("CRISE_HBV") + combo_from = table.cellWidget(7,2) + combo_from.setCurrentText("SOIL[1]") + combo_to = table.cellWidget(7,4) + combo_to.setCurrentText("SOIL[0]") + + combo_proc = table.cellWidget(8,0) + combo_proc.setCurrentText("Percolation") + combo_alg = table.cellWidget(8,1) + combo_alg.setCurrentText("PERC_CONSTANT") + combo_from = table.cellWidget(8,2) + combo_from.setCurrentText("SOIL[1]") + combo_to = table.cellWidget(8,4) + combo_to.setCurrentText("SOIL[2]") + + combo_proc = table.cellWidget(9,0) + combo_proc.setCurrentText("Baseflow") + combo_alg = table.cellWidget(9,1) + combo_alg.setCurrentText("BASE_POWER_LAW") + combo_from = table.cellWidget(9,2) + combo_from.setCurrentText("SOIL[1]") + combo_to = table.cellWidget(9,4) + combo_to.setCurrentText("SURFACE_WATER") + + combo_proc = table.cellWidget(10,0) + combo_proc.setCurrentText("Baseflow") + combo_alg = table.cellWidget(10,1) + combo_alg.setCurrentText("BASE_THRESH_POWER") + combo_from = table.cellWidget(10,2) + combo_from.setCurrentText("SOIL[1]") + combo_to = table.cellWidget(10,4) + combo_to.setCurrentText("SURFACE_WATER") + + combo_proc = table.cellWidget(11,0) + combo_proc.setCurrentText("Baseflow") + combo_alg = table.cellWidget(11,1) + combo_alg.setCurrentText("BASE_LINEAR") + combo_from = table.cellWidget(11,2) + combo_from.setCurrentText("SOIL[2]") + combo_to = table.cellWidget(11,4) + combo_to.setCurrentText("SURFACE_WATER") + + table.resizeColumnsToContents() #Resizes the width of the column automatically + + print("HBV-Light template loaded.") + self.iface.messageBar().pushSuccess("Success", "Loaded HBV-Light template successfully") + except Exception as e: + print('An error occured while loading HBV-Light template.') + print(e) \ No newline at end of file diff --git a/qraven/modules/templates/hmets.py b/qraven/modules/templates/hmets.py index 7f9f9f5..60ee6ed 100644 --- a/qraven/modules/templates/hmets.py +++ b/qraven/modules/templates/hmets.py @@ -1,3 +1,5 @@ +from ..hydrologicproc import addprocess + #This method loads a template of HMETS into the GUI def loadHmets(self): try: @@ -13,7 +15,7 @@ def loadHmets(self): #Sets the hydrological processes for i in range(11): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("SnowBalance") @@ -21,7 +23,7 @@ def loadHmets(self): combo_alg.setCurrentText("SNOBAL_HMETS") combo_from = table.cellWidget(0,2) combo_from.setCurrentText("MULTIPLE") - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(1,0) @@ -30,7 +32,7 @@ def loadHmets(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(1,3) + combo_to = table.cellWidget(1,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(2,0) @@ -39,7 +41,7 @@ def loadHmets(self): combo_alg.setCurrentText("INF_HMETS") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(3,0) @@ -48,7 +50,7 @@ def loadHmets(self): combo_alg.setCurrentText("OVERFLOW_RAVEN") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("CONVOLUTION[1]") combo_proc = table.cellWidget(4,0) @@ -57,7 +59,7 @@ def loadHmets(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(5,0) @@ -66,7 +68,7 @@ def loadHmets(self): combo_alg.setCurrentText("PERC_LINEAR") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("SOIL[1]") combo_proc = table.cellWidget(6,0) @@ -75,7 +77,7 @@ def loadHmets(self): combo_alg.setCurrentText("OVERFLOW_RAVEN") combo_from = table.cellWidget(6,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(6,3) + combo_to = table.cellWidget(6,4) combo_to.setCurrentText("CONVOLUTION[1]") combo_proc = table.cellWidget(7,0) @@ -84,7 +86,7 @@ def loadHmets(self): combo_alg.setCurrentText("SOILEVAP_ALL") combo_from = table.cellWidget(7,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(7,3) + combo_to = table.cellWidget(7,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(8,0) @@ -93,7 +95,7 @@ def loadHmets(self): combo_alg.setCurrentText("CONVOL_GAMMA") combo_from = table.cellWidget(8,2) combo_from.setCurrentText("CONVOLUTION[0]") - combo_to = table.cellWidget(8,3) + combo_to = table.cellWidget(8,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(9,0) @@ -102,7 +104,7 @@ def loadHmets(self): combo_alg.setCurrentText("CONVOL_GAMMA2") combo_from = table.cellWidget(9,2) combo_from.setCurrentText("CONVOLUTION[1]") - combo_to = table.cellWidget(9,3) + combo_to = table.cellWidget(9,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(10,0) @@ -111,7 +113,7 @@ def loadHmets(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(10,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(10,3) + combo_to = table.cellWidget(10,4) combo_to.setCurrentText("SURFACE_WATER") table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/modules/templates/hymod.py b/qraven/modules/templates/hymod.py index 1a8fbf7..a9b3e2b 100644 --- a/qraven/modules/templates/hymod.py +++ b/qraven/modules/templates/hymod.py @@ -1,3 +1,5 @@ +from ..hydrologicproc import addprocess + #This method loads a template of HYMOD into the GUI def loadHymod(self): try: @@ -19,7 +21,7 @@ def loadHymod(self): #Sets the hydrological processes for i in range(6): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("Precipitation") @@ -27,7 +29,7 @@ def loadHymod(self): combo_alg.setCurrentText("PRECIP_RAVEN") combo_from = table.cellWidget(0,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(1,0) @@ -36,7 +38,7 @@ def loadHymod(self): combo_alg.setCurrentText("SNOBAL_SIMPLE_MELT") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("SNOW") - combo_to = table.cellWidget(1,3) + combo_to = table.cellWidget(1,4) combo_to.setCurrentText("PONDED_WATER") combo_proc = table.cellWidget(2,0) @@ -45,7 +47,7 @@ def loadHymod(self): combo_alg.setCurrentText("INF_PDM") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(3,0) @@ -54,11 +56,11 @@ def loadHymod(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("SURFACE_WATER") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("SOIL[1]") - chk_mixingrate = table.cellWidget(3,8) + chk_mixingrate = table.cellWidget(3,10) chk_mixingrate.setChecked(True) - spin_pct = table.cellWidget(3,9) + spin_pct = table.cellWidget(3,11) spin_pct.setValue(0.5) combo_proc = table.cellWidget(4,0) @@ -67,7 +69,7 @@ def loadHymod(self): combo_alg.setCurrentText("SOILEVAP_PDM") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(5,0) @@ -76,7 +78,7 @@ def loadHymod(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("SURFACE_WATER") table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/modules/templates/hypr.py b/qraven/modules/templates/hypr.py index e5d1ce8..d4a6bc0 100644 --- a/qraven/modules/templates/hypr.py +++ b/qraven/modules/templates/hypr.py @@ -1,3 +1,5 @@ +from ..hydrologicproc import addprocess + #This method loads a HYPR template into the GUI def loadHypr(self): try: @@ -20,7 +22,7 @@ def loadHypr(self): #Sets the hydrological processes for i in range(12): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("SnowRefreeze") @@ -28,7 +30,7 @@ def loadHypr(self): combo_alg.setCurrentText("FREEZE_DEGREE_DAY") combo_from = table.cellWidget(0,2) combo_from.setCurrentText("SNOW_LIQ") - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText("SNOW") combo_proc = table.cellWidget(1,0) @@ -37,7 +39,7 @@ def loadHypr(self): combo_alg.setCurrentText("PRECIP_RAVEN") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(1,3) + combo_to = table.cellWidget(1,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(2,0) @@ -46,7 +48,7 @@ def loadHypr(self): combo_alg.setCurrentText("CANEVP_ALL") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("CANOPY") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(3,0) @@ -55,7 +57,7 @@ def loadHypr(self): combo_alg.setCurrentText("SUBLIM_ALL") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("CANOPY_SNOW") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(4,0) @@ -64,7 +66,7 @@ def loadHypr(self): combo_alg.setCurrentText("SNOBAL_SIMPLE_MELT") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("SNOW") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("PONDED_WATER") combo_proc = table.cellWidget(5,0) @@ -73,7 +75,7 @@ def loadHypr(self): combo_alg.setCurrentText("INF_HBV") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(6,0) @@ -82,7 +84,7 @@ def loadHypr(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(6,2) combo_from.setCurrentText("SURFACE_WATER") - combo_to = table.cellWidget(6,3) + combo_to = table.cellWidget(6,4) combo_to.setCurrentText("PONDED_WATER") combo_proc = table.cellWidget(7,0) @@ -91,7 +93,7 @@ def loadHypr(self): combo_alg.setCurrentText("ABST_PDMROF") combo_from = table.cellWidget(7,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(7,3) + combo_to = table.cellWidget(7,4) combo_to.setCurrentText("DEPRESSION") combo_proc = table.cellWidget(8,0) @@ -100,7 +102,7 @@ def loadHypr(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(8,2) combo_from.setCurrentText("SURFACE_WATER") - combo_to = table.cellWidget(8,3) + combo_to = table.cellWidget(8,4) combo_to.setCurrentText("SOIL[1]") combo_proc = table.cellWidget(9,0) @@ -109,7 +111,7 @@ def loadHypr(self): combo_alg.setCurrentText("SOILEVAP_HYPR") combo_from = table.cellWidget(9,2) combo_from.setCurrentText("MULTIPLE") - combo_to = table.cellWidget(9,3) + combo_to = table.cellWidget(9,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(10,0) @@ -118,7 +120,7 @@ def loadHypr(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(10,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(10,3) + combo_to = table.cellWidget(10,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(11,0) @@ -127,7 +129,7 @@ def loadHypr(self): combo_alg.setCurrentText("BASE_THRESH_STOR") combo_from = table.cellWidget(11,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(11,3) + combo_to = table.cellWidget(11,4) combo_to.setCurrentText("SURFACE_WATER") table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/modules/templates/mohyse.py b/qraven/modules/templates/mohyse.py index 4a687a4..93d7ea1 100644 --- a/qraven/modules/templates/mohyse.py +++ b/qraven/modules/templates/mohyse.py @@ -1,3 +1,5 @@ +from ..hydrologicproc import addprocess + #This method loads a MOHYSE template into the GUI def loadMohyse(self): try: @@ -17,7 +19,7 @@ def loadMohyse(self): #Sets the hydrological processes for i in range(7): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("SoilEvaporation") @@ -25,7 +27,7 @@ def loadMohyse(self): combo_alg.setCurrentText("SOILEVAP_LINEAR") combo_from = table.cellWidget(0,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(1,0) @@ -34,7 +36,7 @@ def loadMohyse(self): combo_alg.setCurrentText("SNOBAL_SIMPLE_MELT") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("SNOW") - combo_to = table.cellWidget(1,3) + combo_to = table.cellWidget(1,4) combo_to.setCurrentText("PONDED_WATER") combo_proc = table.cellWidget(2,0) @@ -43,7 +45,7 @@ def loadMohyse(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(3,0) @@ -52,7 +54,7 @@ def loadMohyse(self): combo_alg.setCurrentText("INF_HBV") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("SOIL[0]") combo_proc = table.cellWidget(4,0) @@ -61,7 +63,7 @@ def loadMohyse(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(5,0) @@ -70,7 +72,7 @@ def loadMohyse(self): combo_alg.setCurrentText("PERC_LINEAR") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("SOIL[0]") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("SOIL[1]") combo_proc = table.cellWidget(6,0) @@ -79,7 +81,7 @@ def loadMohyse(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(6,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(6,3) + combo_to = table.cellWidget(6,4) combo_to.setCurrentText("SURFACE_WATER") table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/modules/templates/ubcwm.py b/qraven/modules/templates/ubcwm.py index 6ffcbfc..10f9c68 100644 --- a/qraven/modules/templates/ubcwm.py +++ b/qraven/modules/templates/ubcwm.py @@ -1,3 +1,5 @@ +from ..hydrologicproc import addprocess + #This method loads a UBCWM template into the GUI def loadUbcwm(self): try: @@ -29,7 +31,7 @@ def loadUbcwm(self): #Sets the hydrological processes for i in range(15): - self.addTableRow() + addprocess(self) combo_proc = table.cellWidget(0,0) combo_proc.setCurrentText("SnowAlbedoEvolve") @@ -37,7 +39,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("SNOALB_UBCWM") combo_from = table.cellWidget(0,2) combo_from.setCurrentText('') - combo_to = table.cellWidget(0,3) + combo_to = table.cellWidget(0,4) combo_to.setCurrentText('') combo_proc = table.cellWidget(1,0) @@ -46,7 +48,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("SNOBAL_UBCWM") combo_from = table.cellWidget(1,2) combo_from.setCurrentText("MULTIPLE") - combo_to = table.cellWidget(1,3) + combo_to = table.cellWidget(1,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(2,0) @@ -55,15 +57,15 @@ def loadUbcwm(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(2,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(2,3) + combo_to = table.cellWidget(2,4) combo_to.setCurrentText("SOIL[4]") - checkconditional = table.cellWidget(2,4) + checkconditional = table.cellWidget(2,6) checkconditional.setChecked(True) - combo_basedtype = table.cellWidget(2,5) + combo_basedtype = table.cellWidget(2,7) combo_basedtype.setCurrentText("HRU_TYPE") - combo_comparison = table.cellWidget(2,6) + combo_comparison = table.cellWidget(2,8) combo_comparison.setCurrentText("IS") - txt_hrutype = table.cellWidget(2,7) + txt_hrutype = table.cellWidget(2,9) txt_hrutype.setText("GLACIER") combo_proc = table.cellWidget(3,0) @@ -72,7 +74,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("GMELT_UBC") combo_from = table.cellWidget(3,2) combo_from.setCurrentText("GLACIER_ICE") - combo_to = table.cellWidget(3,3) + combo_to = table.cellWidget(3,4) combo_to.setCurrentText("PONDED_WATER") combo_proc = table.cellWidget(4,0) @@ -81,7 +83,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("PRECIP_RAVEN") combo_from = table.cellWidget(4,2) combo_from.setCurrentText("ATMOS_PRECIP") - combo_to = table.cellWidget(4,3) + combo_to = table.cellWidget(4,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(5,0) @@ -90,7 +92,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("SOILEVAP_UBC") combo_from = table.cellWidget(5,2) combo_from.setCurrentText("MULTIPLE") - combo_to = table.cellWidget(5,3) + combo_to = table.cellWidget(5,4) combo_to.setCurrentText("ATMOSPHERE") combo_proc = table.cellWidget(6,0) @@ -99,7 +101,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("INF_UBC") combo_from = table.cellWidget(6,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(6,3) + combo_to = table.cellWidget(6,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(7,0) @@ -108,15 +110,15 @@ def loadUbcwm(self): combo_alg.setCurrentText("RAVEN_DEFAULT") combo_from = table.cellWidget(7,2) combo_from.setCurrentText("SURFACE_WATER") - combo_to = table.cellWidget(7,3) + combo_to = table.cellWidget(7,4) combo_to.setCurrentText("SOIL[4]") - checkconditional = table.cellWidget(7,4) + checkconditional = table.cellWidget(7,6) checkconditional.setChecked(True) - combo_basedtype = table.cellWidget(7,5) + combo_basedtype = table.cellWidget(7,7) combo_basedtype.setCurrentText("HRU_TYPE") - combo_comparison = table.cellWidget(7,6) + combo_comparison = table.cellWidget(7,8) combo_comparison.setCurrentText("IS_NOT") - txt_hrutype = table.cellWidget(7,7) + txt_hrutype = table.cellWidget(7,9) txt_hrutype.setText("LAKE") combo_proc = table.cellWidget(8,0) @@ -125,7 +127,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("GINFIL_UBCWM") combo_from = table.cellWidget(8,2) combo_from.setCurrentText("PONDED_WATER") - combo_to = table.cellWidget(8,3) + combo_to = table.cellWidget(8,4) combo_to.setCurrentText("MULTIPLE") combo_proc = table.cellWidget(9,0) @@ -134,7 +136,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("PERC_LINEAR_ANALYTIC") combo_from = table.cellWidget(9,2) combo_from.setCurrentText("SOIL[1]") - combo_to = table.cellWidget(9,3) + combo_to = table.cellWidget(9,4) combo_to.setCurrentText("SOIL[4]") combo_proc = table.cellWidget(10,0) @@ -143,7 +145,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("PERC_LINEAR_ANALYTIC") combo_from = table.cellWidget(10,2) combo_from.setCurrentText("SOIL[4]") - combo_to = table.cellWidget(10,3) + combo_to = table.cellWidget(10,4) combo_to.setCurrentText("SOIL[5]") combo_proc = table.cellWidget(11,0) @@ -152,7 +154,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(11,2) combo_from.setCurrentText("SOIL[5]") - combo_to = table.cellWidget(11,3) + combo_to = table.cellWidget(11,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(12,0) @@ -161,7 +163,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(12,2) combo_from.setCurrentText("SOIL[2]") - combo_to = table.cellWidget(12,3) + combo_to = table.cellWidget(12,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(13,0) @@ -170,7 +172,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("BASE_LINEAR") combo_from = table.cellWidget(13,2) combo_from.setCurrentText("SOIL[3]") - combo_to = table.cellWidget(13,3) + combo_to = table.cellWidget(13,4) combo_to.setCurrentText("SURFACE_WATER") combo_proc = table.cellWidget(14,0) @@ -179,7 +181,7 @@ def loadUbcwm(self): combo_alg.setCurrentText("GRELEASE_LINEAR") combo_from = table.cellWidget(14,2) combo_from.setCurrentText("GLACIER") - combo_to = table.cellWidget(14,3) + combo_to = table.cellWidget(14,4) combo_to.setCurrentText("SURFACE_WATER") table.resizeColumnsToContents() #Resizes the width of the column automatically diff --git a/qraven/qraven.py b/qraven/qraven.py index 452cba1..a6d0df2 100644 --- a/qraven/qraven.py +++ b/qraven/qraven.py @@ -31,24 +31,27 @@ from .resources import * # Import the code for the dialog from .qraven_dialog import QRavenDialog - -from qgis.core import Qgis, QgsVectorLayer, QgsRasterLayer, QgsProject -import os.path +from qgis.core import Qgis, QgsVectorLayer, QgsRasterLayer, QgsProject, QgsSettings,QgsFeature,QgsGeometry,QgsField from sys import platform import matplotlib.pyplot as plt -import csv, datetime, webbrowser, ntpath -import requests +import csv, datetime, webbrowser, ntpath, os.path, requests,re from .modules.docker import dockercmd as docker -from .modules.resetgui import resetGUI +from .modules.resetgui import * from .modules.templates.hmets import loadHmets from .modules.templates.hbvec import loadHbvec +from .modules.templates.hbvlight import loadHbvlight from .modules.templates.ubcwm import loadUbcwm from .modules.templates.gr4j import loadGr4j from .modules.templates.canshield import loadCanshield from .modules.templates.mohyse import loadMohyse from .modules.templates.hypr import loadHypr from .modules.templates.hymod import loadHymod +from .modules.templates.awbm import loadAwbm from .modules.PyRavenR import * +from .modules import customoutputs, hydrologicproc +from .modules.datascrapers import streamflow +from .modules.datascrapers.gisdata import gisScraper + class QRaven: """QGIS Plugin Implementation.""" @@ -205,17 +208,29 @@ def run(self): self.first_start = False self.dlg = QRavenDialog() + + self.loadsettings() + self.setupMenubar() self.checkUpdate() - + self.setStreamflowComboboxes() + + self.dlg.list_evalmetrics.sortItems() + self.stations = [] + self.waterofficestations = [] + + self.dlg.sidemenu.currentRowChanged.connect(self.display) + self.dlg.combo_menubar.currentTextChanged.connect(self.setMenuStyle) #-------------Raven RVI-------------# self.dlg.btn_load_hmets.clicked.connect(self.loadModels) self.dlg.btn_load_hbvec.clicked.connect(self.loadModels) + self.dlg.btn_load_hbvlight.clicked.connect(self.loadModels) self.dlg.btn_load_ubcwm.clicked.connect(self.loadModels) self.dlg.btn_load_gr4j.clicked.connect(self.loadModels) self.dlg.btn_load_canadianshield.clicked.connect(self.loadModels) self.dlg.btn_load_mohyse.clicked.connect(self.loadModels) self.dlg.btn_load_hypr.clicked.connect(self.loadModels) self.dlg.btn_load_hymod.clicked.connect(self.loadModels) + self.dlg.btn_load_awbm.clicked.connect(self.loadModels) self.dlg.btn_reset.clicked.connect(self.loadModels) #If the checkbox is checked/unchecked, enables/disables the associated widget @@ -233,19 +248,16 @@ def run(self): self.dlg.chk_chunksize.stateChanged.connect(self.toggleWidget) self.dlg.chk_readlivefile.stateChanged.connect(self.toggleWidget) self.dlg.chk_disablehru.stateChanged.connect(self.toggleWidget) - self.dlg.combo_stat1.activated.connect(self.toggleWidget) - self.dlg.combo_stat2.activated.connect(self.toggleWidget) - self.dlg.combo_stat3.activated.connect(self.toggleWidget) - self.dlg.combo_stat4.activated.connect(self.toggleWidget) - self.dlg.combo_stat5.activated.connect(self.toggleWidget) - self.dlg.combo_stat6.activated.connect(self.toggleWidget) - self.dlg.combo_stat7.activated.connect(self.toggleWidget) + + self.dlg.btn_addoutput.clicked.connect(lambda:customoutputs.addoutput(self)) + self.dlg.btn_rmoutput.clicked.connect(lambda:customoutputs.removeoutput(self)) + #Calls the function to enable/disable the spinbox for the soilmodel and the interpolation lineedit self.dlg.combo_soilmod.currentIndexChanged.connect(self.toggleSoilModel) self.dlg.combo_interpo.activated.connect(self.toggleInterpolation) - self.dlg.btn_addhydroproc.clicked.connect(self.addTableRow) - self.dlg.btn_rmhydroproc.clicked.connect(self.removeTableRow) + self.dlg.btn_addhydroproc.clicked.connect(lambda:hydrologicproc.addprocess(self)) + self.dlg.btn_rmhydroproc.clicked.connect(lambda:hydrologicproc.removeprocess(self)) self.dlg.btn_addtransport.clicked.connect(self.addTransportProc) self.dlg.btn_rmtransport.clicked.connect(self.rmTransportProc) @@ -277,6 +289,27 @@ def run(self): self.dlg.btn_rmigridweight.clicked.connect(lambda:docker.dockerdelete(self)) #----------------------------------------# + #---------------Stream flow---------------# + self.dlg.btn_cehqsearch.clicked.connect(self.searchStreamflow) + self.dlg.btn_cehqdate.clicked.connect(self.downloadStreamflow) + self.dlg.btn_cehqdownload.clicked.connect(self.downloadStreamflow) + self.dlg.btn_cehqlayer.clicked.connect(self.generatePointsLayer) + self.dlg.btn_cehqprocess.clicked.connect(self.downloadStreamflow) + + self.dlg.buttonGroup_4.buttonToggled.connect(self.toggleWidget) + self.dlg.btn_watersurveysearch.clicked.connect(self.searchStreamflow) + self.dlg.btn_waterofficedate.clicked.connect(self.downloadStreamflow) + self.dlg.btn_watersurveydownload.clicked.connect(self.downloadStreamflow) + self.dlg.btn_waterofficelayer.clicked.connect(self.generatePointsLayer) + self.dlg.btn_watersurveyprocess.clicked.connect(self.downloadStreamflow) + #----------------------------------------# + + #---------------GIS Data ----------------# + self.dlg.btn_downloadgisdata.clicked.connect(self.downloadGISdata) + self.dlg.chk_samefilegis.stateChanged.connect(self.copypaths) + self.dlg.btn_gisprocess.clicked.connect(self.processgisdata) + #----------------------------------------# + #-------------Run Raven Model-------------# self.dlg.file_runinputdir.fileChanged.connect(self.setModelname) self.dlg.btn_runraven.clicked.connect(self.runRaven) @@ -285,6 +318,9 @@ def run(self): self.dlg.btn_fillrvptemplate.clicked.connect(self.fillRVPTemplate) #----------------------------------------# + #----------------Settings----------------# + self.dlg.btn_savesettings.clicked.connect(self.storesettings) + #----------------------------------------# # show the dialog self.dlg.show() # Run the dialog event loop @@ -292,8 +328,37 @@ def run(self): # See if OK was pressed if result: + self.iface.messageBar().pushInfo("Info", "QRaven is already opened in another window.") print('The plugin is already opened in another window.' ) + + def setupMenubar(self): + #Sets up the left menu + menuitems = ['Raven RVI','BasinMaker','Gridweights', + 'Streamflow', 'GIS','Run Raven','Settings'] + icons = ['rvifile.svg','basinmaker.svg','gridweights.svg', + 'streamflow.svg','gis.svg','raven.svg','settings.svg'] + script_dir = os.path.dirname(__file__) + for i, menuitem in enumerate(menuitems): + icon = QIcon(os.path.join(script_dir+'/ext_data/icons/'+icons[i])) + self.dlg.sidemenu.addItem(QListWidgetItem(icon, menuitem)) + + self.setMenuStyle() + #Select the first menu item + self.dlg.sidemenu.setCurrentRow(0) + + def setMenuStyle(self): + if self.dlg.combo_menubar.currentText() == 'Collapsed': + self.dlg.sidemenu.setMaximumWidth(50) + self.dlg.sidemenu.setMinimumWidth(50) + else: + self.dlg.sidemenu.setMaximumWidth(150) + self.dlg.sidemenu.setMinimumWidth(150) + + #Changes the view depending on the side menu click + def display(self, i): + self.dlg.stackedWidget.setCurrentIndex(i) + #This method enables and disables widgets based on their checkboxes/radiobutton state def toggleWidget(self): '''Enables/disables widgets based on the widget calling the method''' @@ -373,69 +438,7 @@ def toggleWidget(self): self.dlg.txt_disablehru.setEnabled(True) else: self.dlg.txt_disablehru.setEnabled(False) - elif widget.objectName() == "combo_stat1": - if self.dlg.combo_stat1.currentText().lower() == "histogram": - self.dlg.spin_min1.setEnabled(True) - self.dlg.spin_max1.setEnabled(True) - self.dlg.spin_bin1.setEnabled(True) - else: - self.dlg.spin_min1.setEnabled(False) - self.dlg.spin_max1.setEnabled(False) - self.dlg.spin_bin1.setEnabled(False) - elif widget.objectName() == "combo_stat2": - if self.dlg.combo_stat2.currentText().lower() == "histogram": - self.dlg.spin_min2.setEnabled(True) - self.dlg.spin_max2.setEnabled(True) - self.dlg.spin_bin2.setEnabled(True) - else: - self.dlg.spin_min2.setEnabled(False) - self.dlg.spin_max2.setEnabled(False) - self.dlg.spin_bin2.setEnabled(False) - elif widget.objectName() == "combo_stat3": - if self.dlg.combo_stat3.currentText().lower() == "histogram": - self.dlg.spin_min3.setEnabled(True) - self.dlg.spin_max3.setEnabled(True) - self.dlg.spin_bin3.setEnabled(True) - else: - self.dlg.spin_min3.setEnabled(False) - self.dlg.spin_max3.setEnabled(False) - self.dlg.spin_bin3.setEnabled(False) - elif widget.objectName() == "combo_stat4": - if self.dlg.combo_stat4.currentText().lower() == "histogram": - self.dlg.spin_min4.setEnabled(True) - self.dlg.spin_max4.setEnabled(True) - self.dlg.spin_bin4.setEnabled(True) - else: - self.dlg.spin_min4.setEnabled(False) - self.dlg.spin_max4.setEnabled(False) - self.dlg.spin_bin4.setEnabled(False) - elif widget.objectName() == "combo_stat5": - if self.dlg.combo_stat5.currentText().lower() == "histogram": - self.dlg.spin_min5.setEnabled(True) - self.dlg.spin_max5.setEnabled(True) - self.dlg.spin_bin5.setEnabled(True) - else: - self.dlg.spin_min5.setEnabled(False) - self.dlg.spin_max5.setEnabled(False) - self.dlg.spin_bin5.setEnabled(False) - elif widget.objectName() == "combo_stat6": - if self.dlg.combo_stat6.currentText().lower() == "histogram": - self.dlg.spin_min6.setEnabled(True) - self.dlg.spin_max6.setEnabled(True) - self.dlg.spin_bin6.setEnabled(True) - else: - self.dlg.spin_min6.setEnabled(False) - self.dlg.spin_max6.setEnabled(False) - self.dlg.spin_bin6.setEnabled(False) - elif widget.objectName() == "combo_stat7": - if self.dlg.combo_stat7.currentText().lower() == "histogram": - self.dlg.spin_min7.setEnabled(True) - self.dlg.spin_max7.setEnabled(True) - self.dlg.spin_bin7.setEnabled(True) - else: - self.dlg.spin_min7.setEnabled(False) - self.dlg.spin_max7.setEnabled(False) - self.dlg.spin_bin7.setEnabled(False) + #Conditions for the BasinMaker RVH section below elif widget.objectName() == 'buttonGroup': #buttonGroup is the group of radiobuttons for the mode of define project spatial extent if self.dlg.rb_modehybasin.isChecked(): #If the selected mode is using_hybasin @@ -530,6 +533,13 @@ def toggleWidget(self): self.dlg.txt_dimlat.setEnabled(True) self.dlg.txt_varlon.setEnabled(True) self.dlg.txt_varlat.setEnabled(True) + elif widget.objectName() == 'buttonGroup_4': + if self.dlg.rd_watersurveyname.isChecked(): + self.dlg.txt_watersurveyname.setEnabled(True) + self.dlg.combo_watersurveyprovince.setEnabled(False) + else: + self.dlg.txt_watersurveyname.setEnabled(False) + self.dlg.combo_watersurveyprovince.setEnabled(True) #This method enables and disables the spinbox next to the SoilModel combobox depending on the selected value of the combobox @@ -557,429 +567,6 @@ def toggleInterpolation(self): # self.dlg.txt_outputdir.setText(dir) - def addTableRow(self): - - table = self.dlg.table_hydroprocess #Get the hydrologic processes table - currentRow = table.rowCount() #Get the number of rows the table has - table.insertRow(currentRow) #Inserts a new row below the last row - combo_proc = QComboBox() - combo_alg = QComboBox() - combo_from = QComboBox() - combo_to = QComboBox() - chk_isconditional = QCheckBox() - combo_basedtype = QComboBox() - combo_comparison = QComboBox() - txt_hrutype = QLineEdit() - chk_mixingrate = QCheckBox() - spin_pct = QDoubleSpinBox() - chk_interbasin = QCheckBox() - combo_proc.addItems(procname) #Add a combobox in the new row with all the available processes - combo_basedtype.setEnabled(False) - combo_comparison.setEnabled(False) - txt_hrutype.setEnabled(False) - chk_mixingrate.setEnabled(False) - spin_pct.setEnabled(False) - spin_pct.setDecimals(1) - chk_interbasin.setEnabled(False) - table.setCellWidget(currentRow, 0, combo_proc) #Sets the new combobox in the first column and in the new row - table.setCellWidget(currentRow, 1, combo_alg) - table.setCellWidget(currentRow, 2, combo_from) - table.setCellWidget(currentRow, 3, combo_to) - table.setCellWidget(currentRow, 4, chk_isconditional) - table.setCellWidget(currentRow, 5, combo_basedtype) - table.setCellWidget(currentRow, 6, combo_comparison) - table.setCellWidget(currentRow, 7, txt_hrutype) - table.setCellWidget(currentRow, 8, chk_mixingrate) - table.setCellWidget(currentRow, 9, spin_pct) - table.setCellWidget(currentRow, 10, chk_interbasin) - - table.resizeColumnsToContents() #Resizes the width of the column automatically - combo_proc.currentIndexChanged.connect(self.setProcAlg) #Updates the algorithm combobox if the process changes - chk_isconditional.stateChanged.connect(self.enableConditionalProc) - - def removeTableRow(self): - table = self.dlg.table_hydroprocess - selectedRow = table.currentRow() - table.removeRow(selectedRow) - - - def setProcAlg(self): - #print('Went into the algs') - combo_alg = QComboBox() - combo_from = QComboBox() - combo_to = QComboBox() - spin_pct = QDoubleSpinBox() - chk_interbasin = QCheckBox() - chk_mixingrate = QCheckBox() - spin_pct.setEnabled(False) - chk_interbasin.setEnabled(False) - chk_mixingrate.setEnabled(False) - currentWidget = self.dlg.sender() - index = self.dlg.table_hydroprocess.indexAt(currentWidget.pos()) - widgetRow = index.row() - combo_alg.clear() - combo_alg.addItem('') - - if isinstance(currentWidget, QComboBox): - selectedProc = currentWidget.currentText() - #print(selectedProc) - if selectedProc == 'Precipitation': - combo_alg.addItems(precipalg) - elif selectedProc == 'CanopyEvaporation': - combo_alg.addItems(canopevapAlg) - elif selectedProc == 'CanopySublimation': - combo_alg.addItems(canopysublimationAlg) - elif selectedProc == 'SoilEvaporation': - combo_alg.addItems(soilevapAlg) - elif selectedProc == 'LakeEvaporation': - combo_alg.addItems(lakeevapAlg) - elif selectedProc == 'OpenWaterEvaporation': - combo_alg.addItems(openwaterevapAlg) - elif selectedProc == 'Infiltration': - combo_alg.addItems(infiltrationAlg) - elif selectedProc == 'Percolation': - combo_alg.addItems(percolationAlg) - elif selectedProc == 'CapillaryRise': - combo_alg.addItems(cappilaryriseAlg) - elif selectedProc == 'Baseflow': - combo_alg.addItems(baseflowAlg) - elif selectedProc == 'Interflow': - combo_alg.addItems(interflowAlg) - elif selectedProc == 'Seepage': - combo_alg.addItems(seepageAlg) - elif selectedProc == 'DepressionOverflow': - combo_alg.addItems(depresoverflowAlg) - elif selectedProc == 'LakeRelease': - combo_alg.addItems(lakereleaseAlg) - elif selectedProc == 'Abstraction': - combo_alg.addItems(abstractionAlg) - elif selectedProc == 'SnowMelt': - combo_alg.addItems(snowmeltAlg) - elif selectedProc == 'SnowRefreeze': - combo_alg.addItems(snowrefreezeAlg) - elif selectedProc == 'SnowBalance': - combo_alg.addItems(snowbalanceAlg) - elif selectedProc == 'SnowTempEvolve': - combo_alg.addItems(snowtempevolveAlg) - elif selectedProc == 'Sublimation': - combo_alg.addItems(sublimationAlg) - elif selectedProc == 'SnowAlbedoEvolve': - combo_alg.addItems(snowalbedoevolveAlg) - elif selectedProc == 'SnowSqueeze': - combo_alg.addItems(snowsqueezeAlg) - elif selectedProc == 'CanopyDrip': - combo_alg.addItems(canopydripAlg) - elif selectedProc == 'CropHeatUnitEvolve': - combo_alg.addItems(cropheatunitevAlg) - elif selectedProc == 'GlacierMelt': - combo_alg.addItems(glaciermeltAlg) - elif selectedProc == 'GlacierRelease': - combo_alg.addItems(glacierreleaseAlg) - elif selectedProc == 'GlacierInfiltration': - combo_alg.addItems(glacierinfiltrationAlg) - elif selectedProc == 'Flush': - combo_alg.addItems(flushAlg) - chk_mixingrate.setEnabled(True) - elif selectedProc == 'Overflow': - combo_alg.addItems(overflowAlg) - elif selectedProc == 'Abstraction': - combo_alg.addItems(abstractionAlg) - elif selectedProc == 'Split': - combo_alg.addItems(splitAlg) - chk_mixingrate.setEnabled(True) - elif selectedProc == 'Convolve': - combo_alg.addItems(convolutionAlg) - elif selectedProc == 'LateralFlush': - combo_alg.addItems(lateralflushAlg) - elif selectedProc == 'LateralEquilibrate': - combo_alg.addItems(lateralequilibrateAlg) - spin_pct.setEnabled(True) - spin_pct.setSingleStep(0.1) - spin_pct.setMaximum(1.0) - spin_pct.setMinimum(0.0) - spin_pct.setDecimals(1) - chk_interbasin.setEnabled(True) - elif selectedProc == 'ExchangeFlow': - combo_alg.addItems(exchangeflowAlg) - elif selectedProc == 'Recharge': - combo_alg.addItems(rechargeAlg) - elif selectedProc == 'BlowingSnow': - combo_alg.addItems(blowingsnowAlg) - elif selectedProc == 'SoilBalance': - combo_alg.addItems(soilbalanceAlg) - elif selectedProc == 'RedirectFlow': - combo_alg.setEnabled(False) - - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 1, combo_alg) - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 2, combo_from) - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 3, combo_to) - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 8, chk_mixingrate) - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 9, spin_pct) - - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 10, chk_interbasin) - self.dlg.table_hydroprocess.resizeColumnsToContents() - chk_mixingrate.stateChanged.connect(self.enableMixingRate) - - combo_alg.currentIndexChanged.connect(lambda:self.setStorage(selectedProc)) #Updates the compartments combobox if the algorithm changed - self.setStorage(selectedProc) #Needed for RedirectFlow... there's probably a better way - - #This method sets the combobox values for the from and to compartments based on the selected algorithm - def setStorage(self,selectedProc): - #Clears the lists to avoid infinite duplicates - fromPercolation.clear() - toPercolation.clear() - fromCapillaryRise.clear() - toCapillaryRise.clear() - fromBaseflow.clear() - fromInterflow.clear() - toSeepage.clear() - fromExchangeflow.clear() - toExchangeflow.clear() - fromRecharge.clear() - toRecharge.clear() - fromConvolution.clear() - tmpanyCompartment = anyCompartment.copy() - #Loops through the number of soil layers chosen by the user. Allows to add the soil[m] to comboboxes - if self.dlg.combo_soilmod.currentText().lower() == "soil_multilayer": - numberSoil = int(self.dlg.spin_soilmod.value()) #Get the number of layers - elif self.dlg.combo_soilmod.currentText().lower() == "soil_two_layer": - numberSoil = 2 - else: - numberSoil = 1 - for layer in range(numberSoil): - compartment = "SOIL["+str(layer)+']' #Create the string to append to the list - #Append the soil[m] to the comboboxes - fromPercolation.append(compartment) - toPercolation.append(compartment) - fromCapillaryRise.append(compartment) - toCapillaryRise.append(compartment) - fromBaseflow.append(compartment) - fromInterflow.append(compartment) - toSeepage.append(compartment) - fromExchangeflow.append(compartment) - toExchangeflow.append(compartment) - toRecharge.append(compartment) - tmpanyCompartment.append(compartment) - for layer in range(numberSoil): - compartment = "CONVOLUTION["+str(layer)+']' - fromConvolution.append(compartment) - tmpanyCompartment.append(compartment) - - tmpanyCompartment = list(dict.fromkeys(tmpanyCompartment)) - tmpanyCompartment.sort() - currentWidget = self.dlg.sender() #Get the widget that was triggered - index = self.dlg.table_hydroprocess.indexAt(currentWidget.pos()) #Get the index of the widget - widgetRow = index.row() #Get the row in which the widget is set - combo_from = QComboBox() #Initialize the combobox for the from compartment - combo_to = QComboBox() #Initialize the combobox for the to compartment - combo_from.clear() - combo_to.clear() - - #Sets the value of the compartments based on the selected algorithm - if isinstance(currentWidget, QComboBox): - selectedAlg = currentWidget.currentText() - - #hrugroups = [x.strip() for x in self.dlg.txt_defhru.toPlainText().split(',')] - #combo_from.addItems(hrugroups) - - #if selectedAlg == 'RAVEN_DEFAULT': - #combo_from.addItems(tmpanyCompartment) - #combo_to.addItems(tmpanyCompartment)# - if selectedAlg in precipalg and selectedProc == 'Precipitation': - combo_from.addItems(fromPrecip) - combo_to.addItems(toPrecip) - elif selectedAlg in canopevapAlg: - combo_from.addItems(fromCanevp) - combo_to.addItems(toCanevp) - elif selectedAlg in canopysublimationAlg: - combo_from.addItems(fromCanopySublimation) - combo_to.addItems(toCanopySublimation) - elif selectedAlg in soilevapAlg: - combo_from.addItems(fromSoilevap) - combo_to.addItems(toSoilevap) - elif selectedAlg in lakeevapAlg: - combo_from.addItems(tmpanyCompartment) - combo_to.addItems(toLakeevap) - elif selectedAlg in openwaterevapAlg: - combo_from.addItems(fromOpenwaterevap) - combo_to.addItems(toOpenwaterevap) - elif selectedAlg in infiltrationAlg: - if selectedAlg =='INF_UBC': - combo_from.addItems(fromInfiltration) - combo_to.addItems(toInfiltUBC) - elif selectedAlg =='INF_HMETS': - combo_from.addItems(fromInfiltration) - combo_to.addItems(toInfiltHMETS) - elif selectedAlg =='INF_GA_SIMPLE': - combo_from.addItems(fromInfiltGAsimple) - combo_to.addItems(toInfiltGAsimple) - else: - combo_from.addItems(fromInfiltration) - combo_to.addItems(toInfiltration) - elif selectedAlg in rechargeAlg and selectedProc == 'Recharge': - combo_from.addItems(fromRecharge) - combo_to.addItems(toRecharge) - elif selectedAlg in percolationAlg: - combo_from.addItems(fromPercolation) - combo_to.addItems(toPercolation) - elif selectedAlg in cappilaryriseAlg: - combo_from.addItems(fromCapillaryRise) - combo_to.addItems(toCapillaryRise) - elif selectedAlg in baseflowAlg: - combo_from.addItems(fromBaseflow) - combo_to.addItems(toBaseflow) - elif selectedAlg in interflowAlg: - combo_from.addItems(fromInterflow) - combo_to.addItems(toInterflow) - elif selectedAlg in seepageAlg: - combo_from.addItems(fromSeepage) - combo_to.addItems(toSeepage) - elif selectedAlg in depresoverflowAlg: - combo_from.addItems(fromDepressOverflow) - combo_to.addItems(toDepressOverflow) - elif selectedAlg in lakereleaseAlg: - combo_from.addItems(fromLakeRelease) - combo_to.addItems(toLakeRelease) - elif selectedAlg in abstractionAlg: - if selectedAlg == 'ABST_PDMROF': - combo_from.addItems(fromAbstraction) - combo_to.addItems(toAbstractionPDMROF) - else: - combo_from.addItems(fromAbstraction) - combo_to.addItems(toAbstraction) - elif selectedAlg in snowbalanceAlg: - if selectedAlg == 'SNOBAL_SIMPLE_MELT': - combo_from.addItems(fromSnowbalSimple) - combo_to.addItems(toSnowbalSimple) - elif selectedAlg == 'SNOBAL_COLD_CONTENT': - combo_from.addItems(fromSnowbalColdcontent) - combo_to.addItems(toSnowbalColdcontent) - elif selectedAlg == 'SNOBAL_HBV': - combo_from.addItems(fromSnowbalHBV) - combo_to.addItems(toSnowbalHBV) - elif selectedAlg == 'SNOBAL_TWO_LAYER': - combo_from.addItems(fromSnowbaltwolayer) - combo_to.addItems(toSnowbaltwolayer) - elif selectedAlg == 'SNOBAL_CEMA_NEIGE': - combo_from.addItems(fromSnowbalCema) - combo_to.addItems(toSnowbalCema) - elif selectedAlg == 'SNOBAL_GAWSER': - combo_from.addItems(fromSnowbalGawser) - combo_to.addItems(toSnowbalGawser) - elif selectedAlg == 'SNOBAL_HMETS': - combo_from.addItems(fromSnowbalHMETS) - combo_to.addItems(toSnowbalHMETS) - elif selectedAlg == 'SNOBAL_UBCWM': - combo_from.addItems(fromSnowbalUBCWM) - combo_to.addItems(toSnowbalUBCWM) - elif selectedAlg in snowtempevolveAlg: - combo_from.addItems(fromSnowtempEvolve) - combo_to.addItems(toSnowtempEvolve) - elif selectedAlg in snowmeltAlg: - combo_from.addItems(fromSnowmelt) - combo_to.addItems(toSnowmelt) - elif selectedAlg in snowrefreezeAlg: - combo_from.addItems(fromSnowrefreeze) - combo_to.addItems(tmpanyCompartment) - elif selectedAlg in snowsqueezeAlg: - combo_from.addItems(fromSnowsqueeze) - combo_to.addItems(tmpanyCompartment) - elif selectedAlg in blowingsnowAlg: - combo_from.addItems(fromBlowingsnow) - combo_to.addItems(toBlowingsnow) - elif selectedAlg in snowalbedoevolveAlg: - if selectedAlg == 'SNOALB_BAKER': - combo_from.addItems(fromSnowalbevoBaker) - combo_to.addItems(toSnowalbevoBaker) - else: - combo_from.addItems(fromSnowalbevo) - combo_to.addItems(toSnowalbevo) - elif selectedAlg in sublimationAlg: - combo_from.addItems(fromSublimation) - combo_to.addItems(toSublimation) - elif selectedAlg in canopydripAlg: - combo_from.addItems(fromCanopydrip) - combo_to.addItems(toCanopydrip) - elif selectedAlg in glaciermeltAlg: - combo_from.addItems(fromGlaciermelt) - if selectedAlg == 'GMELT_UBC': - combo_to.addItems(toGlaciermeltUBC) - else: - combo_to.addItems(toGlaciermelt) - elif selectedAlg in glacierreleaseAlg: - combo_from.addItems(fromGlacierRelease) - combo_to.addItems(toGlacierRelease) - elif selectedAlg in glacierinfiltrationAlg: - combo_from.addItems(fromGlacierInfiltration) - combo_to.addItems(toGlacierInfiltration) - elif selectedAlg in exchangeflowAlg and selectedProc == 'ExchangeFlow': - combo_from.addItems(fromExchangeflow) - combo_to.addItems(toExchangeflow) - elif selectedAlg in convolutionAlg: - combo_from.addItems(fromConvolution) - combo_to.addItems(tmpanyCompartment) - elif selectedAlg in cropheatunitevAlg: - combo_from.addItems(fromCropheatunit) - combo_to.addItems(toCropheatunit) - elif selectedProc == 'RedirectFlow': - #fromredirectflow = self.dlg.table_hydroprocess.cellWidget(widgetRow-1,2).currentText() - #toredirectflow = self.dlg.table_hydroprocess.cellWidget(widgetRow-1,3).currentText() - combo_from.addItems(tmpanyCompartment) - combo_to.addItems(tmpanyCompartment) - elif selectedProc == 'Flush' or selectedProc == "Overflow" or selectedProc == 'Split' or selectedProc == 'LateralFlush' or selectedProc == 'LateralEquilibrate': - if selectedProc == 'LateralEquilibrate': - tmpanyCompartment.append('AllHRUs') - combo_from.addItems(tmpanyCompartment) - combo_to.addItems(tmpanyCompartment) - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 2, combo_from) #Set the combobox for the from compartment - self.dlg.table_hydroprocess.setCellWidget(widgetRow, 3, combo_to) #Set the combobox for the to compartment - self.dlg.table_hydroprocess.resizeColumnsToContents() #Resizes automatically the columns - - - def enableConditionalProc(self): - basedtype = ['HRU_TYPE','HRU_GROUP','LAND_CLASS','VEGETATION'] - comparison = ['IS', 'IS_NOT'] - table = self.dlg.table_hydroprocess - currentWidget = self.dlg.sender() - index = self.dlg.table_hydroprocess.indexAt(currentWidget.pos()) - widgetRow = index.row() - combo_basedtype = QComboBox() - combo_comparison = QComboBox() - txt_hrutype = QLineEdit() - if isinstance(currentWidget, QCheckBox): - if currentWidget.isChecked(): - combo_basedtype.addItems(basedtype) - combo_basedtype.setEnabled(True) - combo_comparison.addItems(comparison) - combo_comparison.setEnabled(True) - txt_hrutype.setEnabled(True) - else: - combo_basedtype.setEnabled(False) - combo_comparison.setEnabled(False) - txt_hrutype.setEnabled(False) - table.setCellWidget(widgetRow, 5, combo_basedtype) - table.setCellWidget(widgetRow, 6, combo_comparison) - table.setCellWidget(widgetRow, 7, txt_hrutype) - table.resizeColumnsToContents() #Resizes the width of the column automatically - - def enableMixingRate(self): - table = self.dlg.table_hydroprocess - currentWidget = self.dlg.sender() - index = self.dlg.table_hydroprocess.indexAt(currentWidget.pos()) - widgetRow = index.row() - spin_pct = QDoubleSpinBox() - spin_pct.setSingleStep(0.1) - spin_pct.setMaximum(1.0) - spin_pct.setMinimum(0.0) - spin_pct.setDecimals(1) - if isinstance(currentWidget, QCheckBox): - if currentWidget.isChecked(): - spin_pct.setEnabled(True) - else: - spin_pct.setEnabled(False) - table.setCellWidget(widgetRow, 9, spin_pct) - - def addTransportProc(self): typelist=['Transport','FixedConcentration','FixedTemperature','MassFlux'] table = self.dlg.table_transport #Get the hydrologic processes table @@ -1072,9 +659,9 @@ def writeRVI(self): getCustomOutput() ''' paramDict = self.getParams() #Calls the function to retrieve the widgets values - customOutputList = self.getCustomOutput() #Calls the function to get the custom output values - hydroProcessesList = self.getHydroProcess() + hydroProcessesList = hydrologicproc.getHydroProcess(self) transportProcessesList = self.getTransportProcess() + customOutputList = customoutputs.getOutputs(self) #Calls the function to get the custom output values outputdir = self.dlg.file_rvioutputdir.filePath() #Get the output directory chosen by the use modelName = self.dlg.txt_modname.text() #Get the name of the model disabledhrus_list = paramDict['DisableHRUGroup'].split(',') @@ -1150,26 +737,15 @@ def writeRVI(self): transportCount = 1 rvi.write("\n:"+transport) - - #Writes the custom output - count = 0 - rvi.write("{:<33}".format("\n:CustomOutput")) - for output in customOutputList: - if count == 7: - count = 0 - if output == '': - count+=1 - pass - else: - rvi.write("\n{:<33}".format(":CustomOutput")+output+" ") - count+=1 - else: - if output == ' ': - count+=1 - pass - else: - rvi.write(output + " ") - count+=1 + #Write custom outputs + if customOutputList: + for row in customOutputList: + rvi.write("\n:CustomOutput") + for output in row: + if output == '': + pass + else: + rvi.write(' '+output) print("RVI file written successfully") self.iface.messageBar().pushSuccess("Success", "RVI file written successfully") @@ -1195,10 +771,7 @@ def getParams(self): keyDuration = "EndDate" endDateTmp = self.dlg.date_enddate.dateTime() duration = str(endDateTmp.toPyDateTime()) - #Get the time step - #timeStepTmp = self.dlg.date_timestep.time() - #timeStep = str(timeStepTmp.toPyTime()) - + #Get the time step timestep_h = str("%02d" % self.dlg.spin_timestep_h.value()) timestep_m = str("%02d" % self.dlg.spin_timestep_m.value()) timestep_s = str("%02d" % self.dlg.spin_timestep_s.value()) @@ -1328,6 +901,14 @@ def getParams(self): wateryear = self.dlg.spin_wateryear.value() else: wateryear = '' + if self.dlg.chk_writemassloadings.isChecked(): + writemassloadings = "checked" + else: + writemassloadings = '' + if self.dlg.chk_noisymode.isChecked(): + noisymode = "checked" + else: + noisymode = '' if self.dlg.chk_disablehru.isChecked(): disabledhru = self.dlg.txt_disablehru.toPlainText() else: @@ -1405,6 +986,8 @@ def getParams(self): #Create the dictionary paramsDict = { + "SilentMode" : silentmode, + "NoisyMode" : noisymode, "Calendar" : calendar, "StartDate" : startDate, keyDuration : duration, @@ -1456,11 +1039,11 @@ def getParams(self): "writeForcingFunctions" : writeforcing, "EndPause" : endpause, "DebugMode" : debugmode, - "SilentMode" : silentmode, "WriteDemandFile" : writedemand, "WriteEnergyStorage" : writeenergy, "WriteExhaustiveMB" : writeexausmb, "WriteEnsimFormat" : writeensim, + "WriteMassLoadings" : writemassloadings, "SuppressOutput" : suppressoutput, "SnapshotHydrograph" : snaphydro, "UseStopFile" : usestopfile, @@ -1471,40 +1054,6 @@ def getParams(self): return paramsDict - #This method creates a list with all the hydrologic processes, which is then used to write them into the rvi file - def getHydroProcess(self): - table = self.dlg.table_hydroprocess - rows = table.rowCount() - cols = table.columnCount() - processesList = [] - for row in range(rows): - for col in range(cols): - currentWidget = table.cellWidget(row,col) - if isinstance(currentWidget, QComboBox): - processesList.append(currentWidget.currentText()) - elif isinstance(currentWidget, QCheckBox): - if currentWidget.isChecked(): - if col == 4: - processesList.append('condTrue') #The checkbox is Conditional - elif col == 8: - processesList.append('mixTrue') #The checkbox is Mixing rate - elif col == 10: - #processesList.append('interbasinTrue') #The checkbox is Interbasin - processesList.insert(-5,'interbasinTrue') - else: - processesList.append('False') - elif isinstance(currentWidget, QLineEdit): - processesList.append(currentWidget.text().upper()) - elif isinstance(currentWidget, QDoubleSpinBox): - if table.cellWidget(row,8).isChecked() or table.cellWidget(row,0).currentText() == 'LateralEquilibrate': - #processesList.append("{:.1f}".format(currentWidget.value())) - processesList.insert(-5,"{:.1f}".format(currentWidget.value())) - else: - processesList.append('') - processesList.append("NewLine") - return processesList - - def getTransportProcess(self): table = self.dlg.table_transport rows = table.rowCount() @@ -1525,138 +1074,6 @@ def getTransportProcess(self): processesList.append("") return processesList - - #This method fetches the custom output widgets' values and returns them into a list - def getCustomOutput(self): - '''Loops through all the custom output widgets to retrieve their values - - Returns a list - ''' - #Get the values of the comboboxes - timeperiod1 = self.dlg.combo_time1.currentText() - timeperiod2 = self.dlg.combo_time2.currentText() - timeperiod3 = self.dlg.combo_time3.currentText() - timeperiod4 = self.dlg.combo_time4.currentText() - timeperiod5 = self.dlg.combo_time5.currentText() - timeperiod6 = self.dlg.combo_time6.currentText() - timeperiod7 = self.dlg.combo_time7.currentText() - combostat1 = self.dlg.combo_stat1.currentText() - combostat2 = self.dlg.combo_stat2.currentText() - combostat3 = self.dlg.combo_stat3.currentText() - combostat4 = self.dlg.combo_stat4.currentText() - combostat5 = self.dlg.combo_stat5.currentText() - combostat6 = self.dlg.combo_stat6.currentText() - combostat7 = self.dlg.combo_stat7.currentText() - - #Sets an empty string for the spinboxes if the statistic is not histogram. Otherwise, gets the value of the spinboxes - if combostat1 != 'HISTOGRAM': - spinmin1 = '' - spinmax1 = '' - spinbin1 = '' - else: - spinmin1 = str(self.dlg.spin_min1.value()) - spinmax1 = str(self.dlg.spin_max1.value()) - spinbin1 = str(self.dlg.spin_bin1.value()) - - if combostat2 != 'HISTOGRAM': - spinmin2 = '' - spinmax2 = '' - spinbin2 = '' - else: - spinmin2 = str(self.dlg.spin_min1.value()) - spinmax2 = str(self.dlg.spin_max1.value()) - spinbin2 = str(self.dlg.spin_bin1.value()) - - if combostat3 != 'HISTOGRAM': - spinmin3 = '' - spinmax3 = '' - spinbin3 = '' - else: - spinmin3 = str(self.dlg.spin_min1.value()) - spinmax3 = str(self.dlg.spin_max1.value()) - spinbin3 = str(self.dlg.spin_bin1.value()) - - if combostat4 != 'HISTOGRAM': - spinmin4 = '' - spinmax4 = '' - spinbin4 = '' - else: - spinmin4 = str(self.dlg.spin_min1.value()) - spinmax4 = str(self.dlg.spin_max1.value()) - spinbin4 = str(self.dlg.spin_bin1.value()) - - if combostat5 != 'HISTOGRAM': - spinmin5 = '' - spinmax5 = '' - spinbin5 = '' - else: - spinmin5 = str(self.dlg.spin_min1.value()) - spinmax5 = str(self.dlg.spin_max1.value()) - spinbin5 = str(self.dlg.spin_bin1.value()) - - if combostat6 != 'HISTOGRAM': - spinmin6 = '' - spinmax6 = '' - spinbin6 = '' - else: - spinmin6 = str(self.dlg.spin_min1.value()) - spinmax6 = str(self.dlg.spin_max1.value()) - spinbin6 = str(self.dlg.spin_bin1.value()) - - if combostat7 != 'HISTOGRAM': - spinmin7 = '' - spinmax7 = '' - spinbin7 = '' - else: - spinmin7 = str(self.dlg.spin_min1.value()) - spinmax7 = str(self.dlg.spin_max1.value()) - spinbin7 = str(self.dlg.spin_bin1.value()) - #Gets the variable value - txtvariable1 = self.dlg.txt_var1.text() - txtvariable2 = self.dlg.txt_var2.text() - txtvariable3 = self.dlg.txt_var3.text() - txtvariable4 = self.dlg.txt_var4.text() - txtvariable5 = self.dlg.txt_var5.text() - txtvariable6 = self.dlg.txt_var6.text() - txtvariable7 = self.dlg.txt_var7.text() - #Gets the combobox the spatial evaluation - comboeval1 = self.dlg.combo_eval1.currentText() - comboeval2 = self.dlg.combo_eval2.currentText() - comboeval3 = self.dlg.combo_eval3.currentText() - comboeval4 = self.dlg.combo_eval4.currentText() - comboeval5 = self.dlg.combo_eval5.currentText() - comboeval6 = self.dlg.combo_eval6.currentText() - comboeval7 = self.dlg.combo_eval7.currentText() - #Creates the list containing all the custom output information - customOutputList = [ timeperiod1, combostat1, spinmin1, spinmax1, spinbin1, txtvariable1,comboeval1, - timeperiod2, combostat2, spinmin2, spinmax2, spinbin2,txtvariable2,comboeval2, - timeperiod3, combostat3, spinmin3, spinmax3, spinbin3,txtvariable3,comboeval3, - timeperiod4, combostat4, spinmin4, spinmax4, spinbin4,txtvariable4,comboeval4, - timeperiod5, combostat5, spinmin5, spinmax5, spinbin5,txtvariable5,comboeval5, - timeperiod6, combostat6, spinmin6, spinmax6, spinbin6,txtvariable6,comboeval6, - timeperiod7, combostat7, spinmin7, spinmax7, spinbin7,txtvariable7,comboeval7, - ] - # #Loop through all the Custom Ouput widgets in order to get their values and add them to a list - # for i in range(self.dlg.gridLayout.count()): - # if isinstance(self.dlg.gridLayout.itemAt(i).widget(),QComboBox): #Get the combobox values - # if self.dlg.gridLayout.itemAt(i).widget().currentText() != '': - # customOutputList.append(self.dlg.gridLayout.itemAt(i).widget().currentText()) - # else: - # customOutputList.append(" ") #If the combobox is empty, places an empty space at its place in the list - # elif isinstance(self.dlg.gridLayout.itemAt(i).widget(),QSpinBox): - # if self.dlg.gridLayout.itemAt(i).widget().isEnabled() == True: - # customOutputList.append(str(self.dlg.gridLayout.itemAt(i).widget().value())) - # else: - # customOutputList.append(" ") - # else: - # if self.dlg.gridLayout.itemAt(i).widget().text() != '': #Get the line edit values - # customOutputList.append(self.dlg.gridLayout.itemAt(i).widget().text()) - # else: - # customOutputList.append(" ") #If the line edit is empty, places an empty space at its place in the list - # print(customOutputList) - - return customOutputList - #This method gets all the RVH parameters and returns them into a dictionary def getRVHparams(self): '''Gathers all the values entered by the user inside the BasinMaker RVH tab @@ -1940,13 +1357,29 @@ def dockerinit(self): self.iface.messageBar().pushInfo("Info", "The BasinMaker process is starting, this will take a while to complete.") self.iface.mainWindow().repaint() paramsDict = self.getRVHparams() #Calls the function to get the RVH parameters + containerization = self.dlg.combo_container.currentText() #Get the preferred containerization software + containerimage = self.dlg.combo_dockerimage.currentText() #Get the image + + if containerization == 'Docker': + contnrCMD = 'docker' + if computerOS == 'macos': + os.environ["PATH"] = "/Applications/Docker.app/Contents/Resources/bin" #This is needed for docker to work on MacOS + elif computerOS == 'windows': + os.environ["PATH"] = "C:\\Program Files\\Docker\\Docker\\resources\\bin" #This is needed so that the docker commands work on Windows + elif containerization == 'Podman': + contnrCMD = 'podman' + if computerOS == 'macos': + os.environ["PATH"] = "/opt/podman/bin" + elif computerOS == 'windows': + os.environ["PATH"] = "C:\\Program Files\\RedHat\\Podman" + self.exportRVHparams(paramsDict) #Calls the function to export the RVH parameters into a file - docker.dockerPull(computerOS) #Calls the function to pull the container - docker.dockerStart(computerOS) #Calls the function that starts the container - docker.dockerCopy(self,paramsDict, computerOS, separator) #Calls the function that copies the parameters file to the docker container, as well as the data - docker.runBasinMaker(computerOS) #Calls the function that runs BasinMaker with the provided data and parameters - docker.getDockerResults(self, computerOS, separator) #Calls the function that retrieves the results from BasinMaker - docker.dockerStop() + docker.dockerPull(computerOS, contnrCMD, containerimage) #Calls the function to pull the container + docker.dockerStart(computerOS, contnrCMD, containerimage) #Calls the function that starts the container + docker.dockerCopy(self,paramsDict, computerOS, separator, contnrCMD) #Calls the function that copies the parameters file to the docker container, as well as the data + docker.runBasinMaker(computerOS, contnrCMD) #Calls the function that runs BasinMaker with the provided data and parameters + docker.getDockerResults(self, computerOS, separator, contnrCMD) #Calls the function that retrieves the results from BasinMaker + docker.dockerStop(contnrCMD) #This method runs the gridweight generator inside the Docker container def generateGridWeights(self): @@ -1968,6 +1401,21 @@ def generateGridWeights(self): output = self.dlg.file_outputgridweight.filePath() outputfolder = folderhrus = os.path.dirname(output) outputfile = ntpath.basename(output) + containerization = self.dlg.combo_container.currentText() #Get the preferred containerization software + containerimage = self.dlg.combo_dockerimage.currentText() #Get the image + + if containerization == 'Docker': + contnrCMD = 'docker' + if computerOS == 'macos': + os.environ["PATH"] = "/Applications/Docker.app/Contents/Resources/bin" #This is needed for docker to work on MacOS + elif computerOS == 'windows': + os.environ["PATH"] = "C:\\Program Files\\Docker\\Docker\\resources\\bin" #This is needed so that the docker commands work on Windows + elif containerization == 'Podman': + contnrCMD = 'podman' + if computerOS == 'macos': + os.environ["PATH"] = "/opt/podman/bin" + elif computerOS == 'windows': + os.environ["PATH"] = "C:\\Program Files\\RedHat\\Podman" if self.dlg.rb_subbasinid.isChecked(): selectedid = ' -s ' @@ -1982,12 +1430,9 @@ def generateGridWeights(self): docker.dockerPull(computerOS) #Calls the function to pull the container try: print("Attempting to start the container...") - if computerOS != 'macos': - cmd='docker', 'run', '-t', '-d','-w','/root/BasinMaker','-v', volumenc , '-v', volumehrus, '--name', 'qraven', 'scriptbash/qraven' - docker.dockerCommand(cmd, computerOS) - else: - cmd='docker', 'run', '-t', '-d','-w','/root/BasinMaker','-v', volumenc , '-v', volumehrus, '--name', 'qraven', 'scriptbash/qraven_arm' - docker.dockerCommand(cmd, computerOS) + cmd=contnrCMD, 'run', '-t', '-d','-w','/root/BasinMaker','-v', volumenc , '-v', volumehrus, '--name', 'qraven', containerimage + docker.dockerCommand(cmd, computerOS) + print("The container was started successfully") except Exception as e: print(e) @@ -1999,11 +1444,11 @@ def generateGridWeights(self): else: pythoncmd = 'python3 -u ~/Gridweights/derive_grid_weights.py -i ' + '/root/Gridweights/nc/'+ncfilename + ' -d ' + '"'+dimlon+','+dimlat+'"' + ' -v ' + '"'+varlon+','+varlat+'"' +' -r ' + '/root/Gridweights/hru/' + hrusfilename + selectedid + ' ' + subgauge_id + ' -o ' + '/root/Gridweights/'+outputfile #Bash command to start the Gridweights script print(pythoncmd) - cmd ='docker', 'exec','-t', 'qraven','/bin/bash','-i','-c',pythoncmd #Docker command to run the script + cmd =containerization, 'exec','-t', 'qraven','/bin/bash','-i','-c',pythoncmd #Docker command to run the script try: - os.system("docker start qraven") #Make sure the container is started. Only needed when the plugin is run a second time + os.system(contnrCMD+" start qraven") #Make sure the container is started. Only needed when the plugin is run a second time docker.dockerCommand(cmd, computerOS) - cmd = 'docker', 'cp', 'qraven:/root/Gridweights/'+outputfile, outputfolder + cmd = contnrCMD, 'cp', 'qraven:/root/Gridweights/'+outputfile, outputfolder docker.dockerCommand(cmd, computerOS) print("GridWeights generator has finished processing the files") except Exception as e: @@ -2012,7 +1457,375 @@ def generateGridWeights(self): self.iface.messageBar().pushInfo("Info", "The GridWeights generator process has finished. Check the python logs for more details.") docker.dockerStop() - + def searchStreamflow(self): + widget = self.dlg.sender().objectName() #Get the widget name + + #----CEHQ---# + if widget == 'btn_cehqsearch': + self.dlg.txt_cehqresults.clear() + city = self.dlg.combo_cehqmunicipality.currentText() + river = self.dlg.combo_cehqriver.currentText() + region = self.dlg.combo_cehqadminregion.currentText() + + parser = streamflow.MyHTMLParser() + + html = streamflow.cehq.sendRequest(city,river,region) + parser.feed(html) + data= parser.data + stations = streamflow.cehq.parseTable(data) + if not stations: + self.dlg.txt_cehqresults.appendPlainText('No stations found.') + else: + for line in stations: + isId = True + text = '' + for info in line: + if isId: + text += info.strip()+' - | ' + isId = False + else: + text+= info.strip()+' | ' + text+='\n' + self.dlg.txt_cehqresults.appendPlainText(text) + #----Water office----# + elif widget == 'btn_watersurveysearch': + self.dlg.txt_watersurveyresults.clear() + if self.dlg.rd_watersurveyname.isChecked() and self.dlg.txt_watersurveyname.text() !='': + search_type = 'station_name' + value = self.dlg.txt_watersurveyname.text() + else: + watersurvey_provinces= {'All Provinces':'all', + 'Alberta':'AB', + 'British Columbia':'BC', + 'Manitoba':'MB', + 'New Brunswick':'NB', + 'Newfoundland and Labrador':'NL', + 'Northwest Territories':'NT', + 'Nova Scotia':'NS', + 'Nunavut':'NU', + 'Ontario':'ON', + 'Prince Edward Island':'PE', + 'Quebec':'QC', + 'Saskatchewan':'SK', + 'Yukon':'YT', + } + search_type = 'province' + value = self.dlg.combo_watersurveyprovince.currentText() + value = watersurvey_provinces[value] + regulation = self.dlg.combo_watersurveyregul.currentText() + + if regulation == 'All': + regulation = 'all' + elif regulation == 'Regulated': + regulation = 'R' + else: + regulation = 'N' + status = self.dlg.combo_watersurveystatus.currentText() + if status == 'All': + status = 'all' + elif status == 'Active': + status = 'A' + else: + status = 'D' + + parser = streamflow.MyHTMLParser() + + html = streamflow.watersurvey.sendRequest(search_type,value,regulation,status) + parser.feed(html) + data= parser.data + self.waterofficestations = streamflow.watersurvey.parseTable(data) + + if not self.waterofficestations: + self.dlg.txt_watersurveyresults.appendPlainText('No stations found.') + else: + tmpstation = self.waterofficestations.copy() + for line in tmpstation: + line = line.copy() + del line[-3:] #Removes unecessary info + isId = True + text = '' + for info in line: + if isId: + text += info.strip()+' - | ' + isId = False + else: + text+= info.strip()+' | ' + text+='\n' + self.dlg.txt_watersurveyresults.appendPlainText(text) + + + def downloadStreamflow(self): + widget = self.dlg.sender().objectName() #Get the widget name + #----CEHQ----# + if widget == 'btn_cehqdate': + id = self.dlg.txt_cehqid.text().strip() + if id: + try: + streamflowdata = streamflow.cehq.downloadData(id) + self.observation, self.stationinfo = streamflow.cehq.extractData(streamflowdata,id) + startdate = QtCore.QDate.fromString(self.observation[0][1], "yyyy/MM/dd") + enddate = QtCore.QDate.fromString(self.observation[-1][1], "yyyy/MM/dd") + + self.dlg.date_cehqstartdate.setMinimumDate(startdate) + self.dlg.date_cehqstartdate.setMaximumDate(enddate) + self.dlg.date_cehqstartdate.setDate(startdate) + self.dlg.date_cehqenddate.setMinimumDate(startdate) + self.dlg.date_cehqenddate.setMaximumDate(enddate) + self.dlg.date_cehqenddate.setDate(enddate) + + self.dlg.btn_cehqdownload.setEnabled(True) + except Exception as e: + self.iface.messageBar().pushMessage("Couldn't download the data. Please verify the station ID and dates",level=Qgis.Critical) + print(e) + else: + self.iface.messageBar().pushMessage("A station ID is required.",level=Qgis.Critical) + elif widget == 'btn_cehqdownload': + id = self.dlg.txt_cehqid.text().strip() + startdate = self.dlg.date_cehqstartdate.date().toPyDate() + enddate = self.dlg.date_cehqenddate.date().toPyDate() + output = self.dlg.file_cehqoutput.filePath() + if id and output: + try: + streamflow.cehq.exportRVT(self.observation,output,'web',startdate,enddate) + self.iface.messageBar().pushSuccess("Success", "RVT file written successfully") + self.dlg.txt_cehqidlist.appendPlainText(str(self.stationinfo)) + self.stations.append(self.stationinfo) + self.dlg.txt_cehqid.clear() + self.dlg.btn_cehqdownload.setEnabled(False) + self.dlg.btn_cehqlayer.setEnabled(True) + except Exception as e: + self.iface.messageBar().pushMessage("Couldn't download the data. Please verify the station ID and dates",level=Qgis.Critical) + print(e) + else: + self.iface.messageBar().pushMessage("A station ID and an output file are required.",level=Qgis.Critical) + elif widget == 'btn_cehqprocess': + startdate = self.dlg.date_cehqstartdate.date().toPyDate() + enddate = self.dlg.date_cehqenddate.date().toPyDate() + streamflowpath = self.dlg.file_cehqlocalinput.filePath() + output = self.dlg.file_cehqlocaloutput.filePath() + if streamflowpath and output: + try: + streamflow.cehq.exportRVT(streamflowpath,output,'local',startdate,enddate) + self.iface.messageBar().pushSuccess("Success", "RVT file written successfully") + except Exception as e: + self.iface.messageBar().pushMessage("Couldn't process the file. Please verify the input file",level=Qgis.Critical) + print(e) + else: + self.iface.messageBar().pushMessage("An input and output file are required.",level=Qgis.Critical) + + #-----Water office----# + elif widget == 'btn_waterofficedate': + id = self.dlg.txt_watersurveyid.text().strip() + if id: + self.streamflowdata = streamflow.watersurvey.downloadData(id) + startdate, enddate = streamflow.watersurvey.fetchDates(self.streamflowdata) + startdate = QtCore.QDate.fromString(startdate, "yyyy/MM/dd") + enddate = QtCore.QDate.fromString(enddate, "yyyy/MM/dd") + + self.dlg.date_watersurveystartdate.setMinimumDate(startdate) + self.dlg.date_watersurveystartdate.setMaximumDate(enddate) + self.dlg.date_watersurveystartdate.setDate(startdate) + self.dlg.date_watersurveyenddate.setMinimumDate(startdate) + self.dlg.date_watersurveyenddate.setMaximumDate(enddate) + self.dlg.date_watersurveyenddate.setDate(enddate) + + self.dlg.btn_watersurveydownload.setEnabled(True) + + elif widget == 'btn_watersurveydownload': + id = self.dlg.txt_watersurveyid.text().strip() + startdate = self.dlg.date_watersurveystartdate.date().toPyDate() + enddate = self.dlg.date_watersurveyenddate.date().toPyDate() + output = self.dlg.file_watersurveyoutput.filePath() + + if id and output: + try: + streamflow.watersurvey.exportRVT(self.streamflowdata,output,startdate,enddate) + self.iface.messageBar().pushSuccess("Success", "RVT file written successfully") + stationinfo = [station for station in self.waterofficestations if station[0] == id] + if not stationinfo[0][-1]: + stationinfo[0][-1] = '-9999' + + stationinfo = [stationinfo[0][0],stationinfo[0][-3],stationinfo[0][-2],stationinfo[0][-1]] + self.stations.append(stationinfo) + self.dlg.txt_waterofficeidlist.appendPlainText(str(stationinfo)) + self.dlg.txt_watersurveyid.clear() + self.dlg.btn_watersurveydownload.setEnabled(False) + self.dlg.btn_waterofficelayer.setEnabled(True) + + except Exception as e: + self.iface.messageBar().pushMessage("Couldn't download the data. Please verify the station ID",level=Qgis.Critical) + print(e) + else: + self.iface.messageBar().pushMessage("A station ID and an output file are required.",level=Qgis.Critical) + elif widget == 'btn_watersurveyprocess': + startdate = self.dlg.date_watersurveystartdate.date().toPyDate() + enddate = self.dlg.date_watersurveyenddate.date().toPyDate() + streamflowpath = self.dlg.file_watersurveylocalinput.filePath() + output = self.dlg.file_watersurveylocaloutput.filePath() + if streamflowpath and output: + try: + with open(streamflowpath,'r') as file: + streamflowdata = file.read() + streamflow.watersurvey.exportRVT(streamflowdata,output,startdate,enddate) + self.iface.messageBar().pushSuccess("Success", "RVT file written successfully") + except Exception as e: + self.iface.messageBar().pushMessage("Couldn't process the file. Please verify the input file",level=Qgis.Critical) + print(e) + else: + self.iface.messageBar().pushMessage("An input and output file are required.",level=Qgis.Critical) + + def generatePointsLayer(self): + stations = self.stations + + #Creates layer + vl = QgsVectorLayer("Point", "qrvn_stations", "memory") + pr = vl.dataProvider() + + #Adds fields + pr.addAttributes([ + QgsField("id", QVariant.Int), + QgsField("name", QVariant.String), + QgsField("drain_area", QVariant.Double), + QgsField("source", QVariant.String)]) + vl.updateFields() # tell the vector layer to fetch changes from the provider + + for station in stations: + stationid = re.sub("[^0-9]", "", station[0]) + station[-1] = station[-1].replace(',','') + #Creates a feature + fet = QgsFeature() + + #Sets the geometry + pt = QgsGeometry.fromWkt('Point('+str(station[2])+' '+str(station[1])+')') + fet.setGeometry(pt) + + #Sets the attributes + fet.setAttributes([int(stationid), station[0], float(station[-1]), "CA"]) + #Adds the feature + pr.addFeatures([fet]) + + # update layer's extent when new features have been added + # because change of extent in provider is not propagated to the layer + vl.updateExtents() + QgsProject.instance().addMapLayer(vl) + self.dlg.txt_cehqidlist.clear() + self.dlg.btn_cehqlayer.setEnabled(False) + self.dlg.txt_waterofficeidlist.clear() + self.dlg.btn_waterofficelayer.setEnabled(False) + self.stations=[] + + def downloadGISdata(self): + outputdem = self.dlg.file_fetchdem.filePath() + outputflowdir = self.dlg.file_fetchflowdir.filePath() + outputlakes = self.dlg.file_fetchlakes.filePath() + outputbankfull = self.dlg.file_fetchbankfull.filePath() + outputsoil = self.dlg.file_fetchsoil.filePath() + outputlanduse = self.dlg.file_fetchlanduse.filePath() + file_is_chosen = False + if outputdem: + file_is_chosen = True + gisScraper.dem(self,outputdem) + if outputflowdir: + file_is_chosen = True + gisScraper.flowdirection(self,outputflowdir) + if outputlakes: + file_is_chosen = True + gisScraper.lakes(self,outputlakes) + if outputbankfull: + file_is_chosen = True + gisScraper.bankfull(self,outputbankfull) + if outputlanduse: + file_is_chosen = True + gisScraper.landuse(self,outputlanduse) + if outputsoil: + file_is_chosen = True + gisScraper.soil(self,outputsoil) + if file_is_chosen: + self.dlg.lbl_progressbar.setText('Download complete.') + self.dlg.progress_gisdownload.setValue(0) + else: + self.dlg.lbl_progressbar.setText('Select files first!') + + + def copypaths(self): + outputdem = self.dlg.file_fetchdem.filePath() + outputflowdir = self.dlg.file_fetchflowdir.filePath() + outputlakes = self.dlg.file_fetchlakes.filePath() + outputbankfull = self.dlg.file_fetchbankfull.filePath() + outputsoil = self.dlg.file_fetchsoil.filePath() + outputlanduse = self.dlg.file_fetchlanduse.filePath() + + if self.dlg.chk_samefilegis.isChecked(): + if outputdem: + self.dlg.file_processdem.setFilePath(outputdem+'/na_con_3s.tif') + if outputflowdir: + self.dlg.file_processflowdir.setFilePath(outputflowdir+'/hyd_na_dir_15s.tif') + if outputlakes: + self.dlg.file_processlakes.setFilePath(outputlakes+'/HydroLAKES_polys_v10.shp') + if outputbankfull: + self.dlg.file_processbankfull.setFilePath(outputbankfull+'/nariv.shp') + if outputsoil: + self.dlg.file_processsoil.setFilePath(outputsoil+'/slc_v2r2_canada.shp') + if outputlanduse: + self.dlg.file_processlanduse.setFilePath(outputlanduse+'/landuse.tif') + else: + self.dlg.file_processdem.setFilePath('') + self.dlg.file_processflowdir.setFilePath('') + self.dlg.file_processlakes.setFilePath('') + self.dlg.file_processbankfull.setFilePath('') + self.dlg.file_processsoil.setFilePath('') + self.dlg.file_processlanduse.setFilePath('') + + def processgisdata(self): + overlay = self.dlg.file_giscliplayer.filePath() + dem = self.dlg.file_processdem.filePath() + flowdir = self.dlg.file_processflowdir.filePath() + lakes = self.dlg.file_processlakes.filePath() + bankfull = self.dlg.file_processbankfull.filePath() + soil = self.dlg.file_processsoil.filePath() + landuse = self.dlg.file_processlanduse.filePath() + file_is_chosen = False + + if dem: + file_is_chosen = True + self.dlg.lbl_progressbar2.setText('Clipping DEM.') + gisScraper.cliplayer(self, overlay, dem) + if flowdir: + file_is_chosen = True + self.dlg.lbl_progressbar2.setText('Clipping flow direction.') + gisScraper.cliplayer(self, overlay, flowdir) + if lakes: + file_is_chosen = True + self.dlg.lbl_progressbar2.setText('Clipping lakes.') + gisScraper.cliplayer(self, overlay, lakes) + if bankfull: + file_is_chosen = True + self.dlg.lbl_progressbar2.setText('Clipping bankfull width.') + gisScraper.cliplayer(self, overlay, bankfull) + if soil: + file_is_chosen = True + self.dlg.lbl_progressbar2.setText('Clipping soil.') + gisScraper.cliplayer(self, overlay, soil) + self.dlg.lbl_progressbar2.setText('Joining soil attributes.') + qrvn_soil = os.path.dirname(soil)+'/qrvn_soiltmp.shp' + attTable = os.path.dirname(soil)+'/slc_v2r2_canada_cmp.dbf' + gisScraper.joinattributes(self,qrvn_soil,attTable,'SL','SL','KINDMAT') + #Need to rename attributes abreviation for basinmaker + if landuse: + file_is_chosen = True + self.dlg.lbl_progressbar2.setText('Clipping landuse.') + gisScraper.cliplayer(self, overlay, landuse) + self.dlg.lbl_progressbar2.setText('Polygonizing landuse raster.') + qrvn_landuse = os.path.dirname(landuse)+'/tmp_landuse.tif' + gisScraper.polygonize(self,qrvn_landuse) + + if file_is_chosen: + self.dlg.lbl_progressbar2.setText('File processing complete.') + self.dlg.progress_gisprocess.setValue(0) + else: + self.dlg.lbl_progressbar2.setText('Select files first!') + + #This method opens the rvi file from the input directory and gets two values to populate them in the GUI def setModelname(self): inputdir = self.dlg.file_runinputdir.filePath() #Get the model input directory @@ -2069,7 +1882,9 @@ def fillRVPTemplate(self): rvhfile = prefix+'.rvh' rvpfile = prefix+'.rvp' rvptemplatefile = prefix+'.rvp_temp.rvp' - ravenparametersfile = Path(__file__).parent / "RavenParameters.dat" + script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in + ravenparametersfile ="ext_data/RavenParameters.dat" + ravenparametersfile = os.path.join(script_dir, ravenparametersfile) soil_layers = getSoilLayers(inputdir,separator,rvifile) #!!Simplify the functions to only process the requested information!! landuseclasses,terrainclasses,vegclasses,soilprofileclasses = extractRVHhrus(inputdir,separator,rvhfile) @@ -2190,17 +2005,40 @@ def checkUpdate(self): if 'version=' in line: #loops through the metadata file and searches for the plugin version pluginversion = line.split() print(pluginversion[0]) + installedversion ="" + for letters in pluginversion[0]: + installedversion +=letters+' ' + installedversion=[int(s) for s in installedversion.split() if s.isdigit()] print("Looking for updates") link = "https://raw.githubusercontent.com/Scriptbash/QRaven/main/qraven/metadata.txt" page = requests.get(link) content = page.text - keywords = content.split() - if pluginversion[0] in keywords: - print("version is up to date") - else: + keywords = content.splitlines() + for word in keywords: + if 'version=' in word: + latestrelease = word.split() + latestversion ="" + for letters in latestrelease[0]: + latestversion +=letters+' ' + latestversion=[int(s) for s in latestversion.split() if s.isdigit()] + instver = '' + relver = '' + for number in installedversion: + instver += str(number) + for number in latestversion: + relver += str(number) + installedversion = int(instver) + latestversion = int(relver) + if installedversion == latestversion: + print('QRaven is up to date') + self.dlg.lbl_update.setText('QRaven is up to date.') + elif installedversion > latestversion: + print('Running a pre-release version') + self.dlg.lbl_update.setText('Pre-release version. Please report any issues on GitHub.') + elif installedversion < latestversion: + self.iface.messageBar().pushInfo("Info", "A new version of QRaven is available.") print("Found an update. Please install the latest version of the plugin here: https://github.com/Scriptbash/QRaven/releases") self.dlg.lbl_update.setText('An update is available, please install the latest version https://github.com/Scriptbash/QRaven/releases') - #self.iface.messageBar().pushInfo("Info", "A QRaven update is available, please install the latest version https://github.com/Scriptbash/QRaven/releases") except Exception as e: print(e) print("Could not check for an update. Verify your internet connection.") @@ -2211,32 +2049,129 @@ def loadModels(self): #Calls the function linked to the proper model to load if widget.objectName() == 'btn_reset': - resetGUI(self) + resetmode = self.dlg.combo_resetmode.currentText() + if resetmode == 'Full': + fullReset(self) + elif resetmode == 'Partial': + partialReset(self) elif widget.objectName() == 'btn_load_hmets': - resetGUI(self) + partialReset(self) loadHmets(self) elif widget.objectName() == 'btn_load_hbvec': - resetGUI(self) + partialReset(self) loadHbvec(self) + elif widget.objectName() == 'btn_load_hbvlight': + partialReset(self) + loadHbvlight(self) elif widget.objectName() == 'btn_load_ubcwm': - resetGUI(self) + partialReset(self) loadUbcwm(self) elif widget.objectName() == 'btn_load_gr4j': - resetGUI(self) + partialReset(self) loadGr4j(self) elif widget.objectName() == 'btn_load_canadianshield': - resetGUI(self) + partialReset(self) loadCanshield(self) elif widget.objectName() == 'btn_load_mohyse': - resetGUI(self) + partialReset(self) loadMohyse(self) elif widget.objectName() == 'btn_load_hypr': - resetGUI(self) + partialReset(self) loadHypr(self) elif widget.objectName() == 'btn_load_hymod': - resetGUI(self) - loadHymod(self) + partialReset(self) + loadHymod(self) + elif widget.objectName() == 'btn_load_awbm': + partialReset(self) + loadAwbm(self) + + def setStreamflowComboboxes(self): + script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in + citiespath = "ext_data/cities.txt" + regionspath = "ext_data/regions.txt" + riverspath = "ext_data/rivers.txt" + citiesfile = os.path.join(script_dir, citiespath) + regionsfile = os.path.join(script_dir, regionspath) + riversfile = os.path.join(script_dir, riverspath) + + cities = [] + with open(citiesfile) as file: + for line in file: + city = line.strip() + if city: + cities.append(city) + self.dlg.combo_cehqmunicipality.addItem("") + self.dlg.combo_cehqmunicipality.addItems(cities) + + regions = [] + with open(regionsfile) as file: + for line in file: + region = line.strip() + if region: + regions.append(region) + self.dlg.combo_cehqadminregion.addItem("") + self.dlg.combo_cehqadminregion.addItems(regions) + + rivers = [] + with open(riversfile) as file: + for line in file: + river = line.strip('\n') + if river: + rivers.append(river) + self.dlg.combo_cehqriver.addItem("") + self.dlg.combo_cehqriver.addItems(rivers) + + provinces = ['All Provinces','Alberta','British Columbia','Manitoba', + 'New Brunswick','Newfoundland and Labrador', 'Northwest Territories', + 'Nova Scotia','Nunavut','Ontario','Prince Edward Island', + 'Quebec','Saskatchewan','Yukon' + ] + self.dlg.combo_watersurveyprovince.addItems(provinces) + + def storesettings(self): + containerization = self.dlg.combo_container.currentText() + containerimage = self.dlg.combo_dockerimage.currentText() + username = self.dlg.txt_casparusername.text() + password = self.dlg.txt_casparpassword.text() + resetmode = self.dlg.combo_resetmode.currentText() + menubar = self.dlg.combo_menubar.currentText() + + + s = QgsSettings() + + s.setValue("qraven/container", containerization) + s.setValue("qraven/image",containerimage) + s.setValue("qraven/casparUsername", username) + s.setValue("qraven/casparPassword", password) + s.setValue("qraven/resetmode",resetmode) + s.setValue("qraven/menubar",menubar) + + self.iface.messageBar().pushSuccess("Success", "Your settings have been saved.") + + def loadsettings(self): + s = QgsSettings() + + if computerOS == 'macos': + defaultimage = 'scriptbash/qraven_arm:latest' + else: + defaultimage = 'scriptnash/qraven:latest' + + containerization = s.value("qraven/container", "Docker") + containerimage = s.value("qraven/image",defaultimage) + username = s.value("qraven/casparUsername", "") + password = s.value("qraven/casparPassword", "") + resetmode = s.value("qraven/resetmode","Full") + menubar = s.value("qraven/menubar",'Default') + + self.dlg.combo_container.setCurrentText(containerization) + self.dlg.combo_dockerimage.setCurrentText(containerimage) + self.dlg.txt_casparusername.setText(username) + self.dlg.txt_casparpassword.setText(password) + self.dlg.combo_resetmode.setCurrentText(resetmode) + self.dlg.combo_menubar.setCurrentText(menubar) + + #This function returns the user's operating system. Mainly used to put slashes and backslashes accordingly in paths def checkOS(): '''Makes a simple check to verify which operating system the user is using. @@ -2246,193 +2181,9 @@ def checkOS(): if platform == "linux" or platform == "linux2": return "linux","/" elif platform == "darwin": - os.environ["PATH"] = "/Applications/Docker.app/Contents/Resources/bin" #This is needed for docker to work on MacOS return "macos", "/" elif platform == "win32": - os.environ["PATH"] = "C:\\Program Files\\Docker\\Docker\\resources\\bin" #This is needed so that the docker commands work on Windows return "windows", "\\" -computerOS, separator = checkOS() - -#List that contains every process name -procname = ['','Baseflow','CanopyEvaporation','CanopyDrip','Infiltration', - 'Percolation','SnowMelt','SoilEvaporation','SnowBalance', - 'Sublimation','OpenWaterEvaporation','Precipitation','Interflow', - 'SnowRefreeze','Flush','CapillaryRise','LakeEvaporation','SnowSqueeze', - 'GlacierMelt','GlacierRelease','CanopySublimation', - 'Overflow','SnowAlbedoEvolve','CropHeatUnitEvolve','Abstraction','GlacierInfiltration', - 'Split','Convolve','SnowTempEvolve','DepressionOverflow','ExchangeFlow', - 'LateralFlush','Seepage','Recharge','BlowingSnow','LakeRelease','SoilBalance','LateralEquilibrate','RedirectFlow' - ] -procname.sort() #Sorts the list ascending - -#Lists with all of the Raven algorithms -baseflowAlg = ['BASE_VIC','BASE_TOPMODEL','BASE_LINEAR','BASE_LINEAR_CONSTRAIN', - 'BASE_LINEAR_ANALYTIC','BASE_POWER_LAW','BASE_CONSTANT', - 'BASE_THRESH_POWER','BASE_THRESH_STOR','BASE_GR4J' - ] -canopevapAlg = ['CANEVP_RUTTER','CANEVP_MAXIMUM','CANEVP_ALL'] -canopydripAlg = ['CANDRIP_RUTTER','CANDRIP_SLOWDRAIN'] -infiltrationAlg = ['INF_GREEN_AMPT','INF_GA_SIMPLE','INF_VIC_ARNO','INF_VIC', - 'INF_RATIONAL','INF_PRMS','INF_HBV','INF_UBC','INF_PARTITION', - 'INF_GR4J','INF_SCS','INF_SCS_NOABSTRACTION','INF_HMETS', - 'INF_ALL_INFILTRATES','INF_XINANXIANG','INF_PDM' - ] -percolationAlg = ['PERC_POWER_LAW','POWER_LAW','PERC_GAWSER','PERC_GAWSER_CONSTRAIN', - 'PERC_PRMS','PERC_SACRAMENTO','PERC_CONSTANT','PERC_LINEAR', - 'PERC_LINEAR_ANALYTIC','PERC_GR4J','PERC_GR4JEXCH','PERC_GR4JEXCH2','PERC_ASPEN' - ] -snowmeltAlg = ['MELT_POTMELT'] #Obsolete -soilevapAlg = ['SOILEVAP_VIC','SOILEVAP_TOPMODEL','SOILEVAP_SEQUEN','SOILEVAP_ROOT', - 'SOILEVAP_ROOT_CONSTRAIN','SOILEVAP_HBV','SOILEVAP_HYPR','SOILEVAP_UBC', - 'SOILEVAP_PDM','SOILEVAP_CHU','SOILEVAP_GR4J','SOILEVAP_LINEAR', - 'SOILEVAP_SACSMA','SOILEVAP_ALL' - ] -snowbalanceAlg = ['SNOBAL_COLD_CONTENT','SNOBAL_SIMPLE_MELT','SNOBAL_UBCWM', - 'SNOBAL_HBV','SNOBAL_CEMA_NEIGE','SNOBAL_TWO_LAYER', - 'SNOBAL_GAWSER','SNOBAL_CRHM_EBSM','SNOBAL_HMETS' - ] -sublimationAlg = ['SUBLIM_SVERDRUP','SUBLIM_KUZMIN','SUBLIM_CENTRAL_SIERRA', - 'SUBLIM_PBSM','SUBLIM_KUCHMENT_GELFAN','SUBLIM_BULK_AERO' - ] -openwaterevapAlg = ['OPEN_WATER_EVAP','OPEN_WATER_RIPARIAN','OPEN_WATER_UWFS'] -precipalg = ['PRECIP_RAVEN','RAVEN_DEFAULT'] -interflowAlg = ['PRMS'] -snowrefreezeAlg = ['FREEZE_DEGREE_DAY'] -flushAlg = ['FLUSH_RAVEN','RAVEN_DEFAULT'] -cappilaryriseAlg = ['CRISE_HBV'] -lakeevapAlg = ['BASIC','LAKE_EVAP_BASIC'] -snowsqueezeAlg = ['SQUEEZE_RAVEN'] #:SnowSqueeze SQUEEZE_RAVEN SNOW_LIQ [state_var to_index] -glaciermeltAlg = ['GMELT_HBV','GMELT_UBC','GMELT_SIMPLE_MELT'] -glacierreleaseAlg = ['GRELEASE_HBV_EC','LINEAR_STORAGE','GRELEASE_LINEAR','GRELEASE_LINEAR_ANALYTIC'] -canopysublimationAlg = ['SUBLIM_ALL','SUBLIM_MAXIMUM','SUBLIM_SVERDRUP', - 'SUBLIM_KUZMIN','SUBLIM_CENTRAL_SIERRA','SUBLIM_PBSM', - 'SUBLIM_KUCHMENT_GELFAN','SUBLIM_BULK_AERO' - ] -overflowAlg = ['OVERFLOW_RAVEN','RAVEN_DEFAULT'] -snowalbedoevolveAlg = ['SNOALB_UBCWM','SNOALB_CRHM_ESSERY','SNOALB_BAKER'] -cropheatunitevAlg = ['CHU_ONTARIO'] -abstractionAlg = ['ABST_SCS','ABST_PERCENTAGE','ABST_FILL', - 'ABST_PDMROF','ABST_UWFS' - ] #:Abstraction [string method] PONDED_WATER DEPRESSION/MULTIPLE -glacierinfiltrationAlg = ["GINFIL_UBCWM"] -splitAlg = ['RAVEN_DEFAULT'] -convolutionAlg = ['CONVOL_GR4J_1','CONVOL_GR4J_2','CONVOL_GAMMA','CONVOL_GAMMA2'] -snowtempevolveAlg = ['SNOTEMP_NEWTONS'] -depresoverflowAlg = ['DFLOW_THRESHPOW','DFLOW_LINEAR','DFLOW_WEIR'] -exchangeflowAlg = ['RAVEN_DEFAULT']#:ExchangeFlow RAVEN_DEFAULT [state_var from] [state_var mixing_zone] -lateralflushAlg = ['RAVEN_DEFAULT'] #Interbasin -seepageAlg = ['SEEP_LINEAR'] -rechargeAlg = ['RECHARGE_CONSTANT','RECHARGE_FROMFILE','RAVEN_DEFAULT', - 'RECHARGE_CONSTANT_OVERLAP','RECHARGE_DATA','RECHARGE_FLUX' - ] #:Recharge RECHARGE_FROMFILE ATMOS_PRECIP SOIL[?] -blowingsnowAlg = ['PBSM'] #:BlowingSnow PBSM MULTIPLE MULTIPLE -lakereleaseAlg = ['LAKEREL_LINEAR'] -soilbalanceAlg = ['SOILBAL_SACSMA'] #:SoilBalance SOILBAL_SACSMA MULTIPLE MULTIPLE -lateralequilibrateAlg = ['RAVEN_DEFAULT'] #Interbasin - -#Lists of the compartments of each algorithm. Can easily add new compartments if new compartments are added in Raven -#Empty brackets = any soil or any convolution -fromPrecip = ["ATMOS_PRECIP","COLD_CONTENT", "SNOW_DEPTH"] -toPrecip = ["SNOW","PONDED_WATER","DEPRESSION","WETLAND","CANOPY","CANOPY_SNOW", - "SURFACE_WATER", "ATMOSPHERE","SNOW_LIQ","SNOW_DEFICIT","NEW_SNOW", - "COLD_CONTENT","SNOW_DEPTH","MULTIPLE",'' - ] -fromCanevp = ["CANOPY",''] -toCanevp = ["ATMOSPHERE",''] -fromCanopySublimation = ['CANOPY_SNOW',''] -toCanopySublimation = ['ATRMOSPHERE',''] -fromSoilevap = ["SOIL[0]",'MULTIPLE',''] -toSoilevap = ["ATMOSPHERE",''] -toLakeevap = ["ATMOSPHERE",''] -fromOpenwaterevap = ["DEPRESSION",''] -toOpenwaterevap = ["ATMOSPHERE",''] -fromInfiltration = ["PONDED_WATER","MULTIPLE",''] -toInfiltration = ["SOIL[0]","SURFACE_WATER","MULTIPLE",''] -toInfiltUBC = ["SOIL[0]","SOIL[1]","SOIL[2]","SOIL[3]","SURFACE_WATER","MULTIPLE",''] -toInfiltHMETS = ["SOIL[0]","CONVOLUTION[0]","CONVOLUTION[1]",'MULTIPLE',''] -fromInfiltGAsimple = ["PONDED_WATER","GA_MOISTURE_INIT",''] -toInfiltGAsimple = ["SOIL[0]","SURFACE_WATER","GA_MOISTURE_INIT","MULTIPLE",''] -fromPercolation = [] -toPercolation = [] -fromCapillaryRise = [] -toCapillaryRise = [] -fromBaseflow = [] -toBaseflow = ['SURFACE_WATER',''] -fromRecharge = ['ATMOS_PRECIP',''] #Need to check for other algorithms -toRecharge = [] -fromSnowsqueeze = ["SNOW_LIQ",''] -toSnowsqueeze = [] -fromInterflow = [] -toInterflow = ['SURFACE_WATER',''] -fromSeepage = ['DEPRESSION',''] -toSeepage = [] -fromDepressOverflow = ['DEPRESSION',''] -toDepressOverflow = ['SURFACE_WATER',''] -fromLakeRelease = ['LAKE_STORAGE','SURFACE_WATER',''] #!!!! THIS ONE IS INCORRECT -toLakeRelease = ['SURFACE_WATER',''] -fromAbstraction = ['PONDED_WATER',''] -toAbstraction = ['DEPRESSION'] -toAbstractionPDMROF = ['DEPRESSION','SURFACE_WATER',''] -fromSnowmelt = ['SNOW',''] -toSnowmelt = ['PONDED_WATER',''] -fromSnowrefreeze = ['SNOW_LIQ',''] -fromSnowbalSimple = ['SNOW',''] -toSnowbalSimple = ['PONDED_WATER','SNOW_LIQ',''] -fromSnowbalColdcontent = ['SNOW','SNOW_LIQ',"COLD_CONTENT","ENERGY_LOSSES","MULTIPLE",''] -toSnowbalColdcontent = ['SNOW','SNOW_LIQ','SURFACE_WATER',"COLD_CONTENT","ENERGY_LOSSES","MULTIPLE",''] -fromSnowbalHBV = ['SNOW','SNOW_LIQ',"MULTIPLE",''] -toSnowbalHBV = ['SNOW_LIQ','SOIL[0]',"MULTIPLE",''] -fromSnowbaltwolayer = ['NEW_SNOW','PONDED_WATER','SNOW','SNOW_LIQ[0]','SNOW_LIQ[1]','COLD_CONTENT[0]','COLD_CONTENT[1]','SNOW_TEMP','CUM_SNOWMELT',"MULTIPLE",''] -toSnowbaltwolayer = ['SNOW','SNOW_LIQ[0]','SNOW_LIQ[1]','PONDED_WATER','COLD_CONTENT[0]','COLD_CONTENT[1]','SNOW_TEMP','CUM_SNOWMELT',"MULTIPLE",''] -fromSnowbalCema = ['SNOW','SNOW_COVER',"MULTIPLE",''] -toSnowbalCema = ['PONDED_WATER','SNOW_COVER',"MULTIPLE",''] -fromSnowbalGawser = ['SNOW','SNOW_LIQ','COLD_CONTENT',"MULTIPLE",''] -toSnowbalGawser = ['SNOW','SNOW_LIQ','COLD_CONTENT','PONDED_WATER',"MULTIPLE",''] -fromSnowbalUBCWM = ['SNOW','SNOW_LIQ','COLD_CONTENT','SNOW_COVER','CUM_SNOWMELT','SNOW_DEFICIT','MULTIPLE',''] -toSnowbalUBCWM = ['SNOW','SNOW_LIQ','PONDED_WATER','COLD_CONTENT','SNOW_COVER','CUM_SNOWMELT','SNOW_DEFICIT','MULTIPLE',''] -fromSnowbalHMETS = ['SNOW','SNOW_LIQ','CUM_SNOWMELT','MULTIPLE',''] -toSnowbalHMETS = ['SNOW_LIQ','MULTIPLE',''] -fromSnowbalCRHM = ['SNOW','SNOW_LIQ','COLD_CONTENT',"MULTIPLE",''] -toSnowbalCRHM = ['SNOW','SNOW_LIQ','CUM_SNOWMELT','PONDED_WATER',"MULTIPLE",''] -fromSnowtempEvolve = ['SNOW_TEMP',''] -toSnowtempEvolve = ['SNOW_TEMP',''] -fromBlowingsnow = ['SNOW','SNOW_AGE','SNOW_DEPTH','SNODRIFT_TEMP','SNOW_LIQ',''] -toBlowingsnow = ['SNOW_AGE','SNOW_DEPTH','SNOW_DRIFT','SNODRIFT_TEMP','ATMOSPHERE',''] -fromSublimation = ['SNOW',''] -toSublimation = ['ATMOSPHERE',''] -fromSnowalbevo = ['SNOW_ALBEDO',''] -toSnowalbevo = ['SNOW_ALBEDO',''] -fromSnowalbevoBaker = ['SNOW_ALBEDO','SNOW_AGE',''] -toSnowalbevoBaker = ['SNOW_ALBEDO','SNOW_AGE',''] -fromCanopydrip = ['CANOPY',''] -toCanopydrip = ['PONDED_WATER',''] -fromGlaciermelt = ['GLACIER_ICE',''] -toGlaciermelt = ['GLACIER',''] -toGlaciermeltUBC = ['GLACIER','PONDED_WATER',''] #Ponded water is not in the .dat file, but is in the template and raven source code -fromGlacierInfiltration = ['PONDED_WATER',''] -toGlacierInfiltration = ['GLACIER','SOIL[2]','SOIL[3]','MULTIPLE',''] -fromGlacierRelease = ['GLACIER',''] -toGlacierRelease = ['SURFACE_WATER',''] -fromExchangeflow = [] -toExchangeflow = [] -fromConvolution = [] -fromCropheatunit = ['CROP_HEAT_UNIT',''] -toCropheatunit = ['CROP_HEAT_UNIT',''] - -anyCompartment = list(set().union( - fromPrecip,toPrecip,fromCanevp,toCanevp,fromSoilevap,toSoilevap, - toLakeevap,fromOpenwaterevap,toOpenwaterevap,fromInfiltration,toInfiltration, - toInfiltUBC,toInfiltHMETS,fromInfiltGAsimple,toInfiltGAsimple,toBaseflow,fromRecharge, - fromSnowsqueeze,toInterflow,fromSeepage,fromDepressOverflow,toDepressOverflow, - fromLakeRelease,toLakeRelease,fromAbstraction,toAbstraction,toAbstractionPDMROF,fromSnowmelt, - toSnowmelt,fromSnowrefreeze,fromSnowbalSimple,toSnowbalSimple,fromSnowbalColdcontent,toSnowbalColdcontent, - fromSnowbalHBV,toSnowbalHBV,fromSnowbaltwolayer,toSnowbaltwolayer,fromSnowbalCema, - toSnowbalCema,fromSnowbalGawser,toSnowbalGawser,fromSnowbalUBCWM,toSnowbalUBCWM,fromSnowbalHMETS, - toSnowbalHMETS,fromSnowbalCRHM,toSnowbalCRHM,fromSnowtempEvolve,toSnowtempEvolve, - fromBlowingsnow,toBlowingsnow,fromSublimation,toSublimation,fromSnowalbevo,toSnowalbevo, - fromSnowalbevoBaker,toSnowalbevoBaker,fromCanopydrip,toCanopydrip,fromGlaciermelt,toGlaciermelt, - fromGlacierInfiltration,toGlacierInfiltration,fromGlacierRelease,toGlacierRelease, - fromCropheatunit,toCropheatunit - )) \ No newline at end of file +computerOS, separator = checkOS() \ No newline at end of file diff --git a/qraven/qraven_dialog_base.ui b/qraven/qraven_dialog_base.ui index 658bee9..42bbaf4 100644 --- a/qraven/qraven_dialog_base.ui +++ b/qraven/qraven_dialog_base.ui @@ -6,3978 +6,2677 @@ 0 0 - 1091 - 736 + 1137 + 774 QRaven + + + icon.pngicon.png + + + false + + + + + + 0 + + + 0 + + + 0 + + + 0 + - - - Qt::LeftToRight - - - QTabWidget::North + + + - - QTabWidget::Rounded - - - 0 - - - false - - - - Raven RVI - - - - - 0 - 0 - 1071 - 571 - - - - Qt::LeftToRight - - - QTabWidget::North - - - QTabWidget::Rounded - - - 2 - - - - Model info - - - - - - true - - - - - 0 - 0 - 423 - 645 - - - - - - - - 0 - 97 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Hours - - + + + 0 + + + 0 + + + 0 + + + + + + 150 + 0 + + + + + 200 + 16777215 + + + + + 0 + 0 + + + + + 75 + true + + + + background:rgb(78, 78, 78); +color:rgb(170, 170, 170) + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + 45 + 35 + + + + 0 + + + true + + + -1 + + + + + + + 0 + + + + + 0 + + + 0 + + + + + + + + 0 + + + + + + + Model info + + + + + + + 0 + + + 15 + + + 0 + + + 33 + + + + + Minutes + + + + + + + Seconds + + + + + + + Hours + + + + + + + 24 + + + + + + + 59 + + + + + + + 59 + + + + + + + + + + DefineHRUGroups + + + + + + + Templates + + + Qt::AlignCenter + + + + + + + StartDate + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + SOIL_ONE_LAYER + - - - - Minutes - - + + + SOIL_TWO_LAYER + - - - - 24 - - - QAbstractSpinBox::DefaultStepType - - + + + SOIL_MULTILAYER + - - - - Seconds - - + + + + + + false + + + + + + + + + + Output directory + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + yyyy-MM-dd h:mm + + + + + + + + 16777215 + 60 + + + + FOREST, GRASSLAND, WATER + + + + + + + DisableHRUGroup + + + + + + + Model name + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + TimeStep + + + + + + + false + + + + 16777215 + 60 + + + + FOREST, GRASSLAND, WATER + + + + + + + Qt::LeftToRight + + + Use Duration instead + + + + + + + EndDate + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + UBCWM + + + + + + + HBV-EC + + + + + + + yyyy-MM-dd h:mm + + + + + + + SoilModel + + + + + + + QgsFileWidget::GetDirectory + + + + + + + false + + + 999999999 + + + + + + + AWBM + + + + + + + HYMOD + + + + + + + HYPR + + + + + + + HMETS + + + + + + + MOHYSE + + + + + + + Canadian Shield + + + + + + + GR4J + + + + + + + HBV-Light + + + + + + + + Sim. parameters + + + + + + SWCloudCorrect + + + + + + + CatchmentRoute + + + + + + + + + - - - - 59 - - + + + MONTHINT_UNIFORM + - - - - 59 - - + + + MONTHINT_LINEAR_MID + - - - - - - - false - - - FOREST, GRASSLAND, WATER - - - - - - - SoilModel - - - - - - - Qt::LeftToRight - - - DefineHRUGroups - - - - - - - false - - - - - - - - - - - - - QgsFileWidget::GetDirectory - - - - - - - false - - - 999999999 - - - - - - - - 0 - 110 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - MOHYSE - - + + + MONTHINT_LINEAR_FOM + - - - - HBV-EC - - + + + MONTHINT_LINEAR_21 + - - - - HYMOD - - + + + + + + RelativeHumidityMethod + + + + + + + CloudCoverMethod + + + + + + + + ROUTE_DUMP + - - - - GR4J - - + + + ROUTE_DELAYED_FIRST_ORDER + - - - - HYPR - - + + + ROUTE_GAMMA_CONVOLUTION + - - - - UBCWM - - + + + ROUTE_TRI_CONVOLUTION + - - - - Canadian Shield - - + + + ROUTE_RESERVOIR_SERIES + - - - - HMETS - - + + + + + + + + - - - - Templates - - - Qt::AlignCenter - - + + + AIRPRESS_BASIC + - - - - - - - - 135 - 16777215 - - - - - 0 - 0 - - - - Qt::RightToLeft - - - DisableHRUGroup - - - - - - - - - - Output Directory - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - StartDate - - - - - - - yyyy-MM-dd h:mm:ss - - - - - - - Qt::RightToLeft - - - Use Duration instead - - - - - - - - SOIL_ONE_LAYER - - - - - SOIL_TWO_LAYER - - - - - SOIL_MULTILAYER - - - - - - - - yyyy-MM-dd h:mm:ss - - - - - - - Model Name - - - - - - - FOREST, GRASSLAND, WATER - - - - - - - EndDate - - - - - - - - 0 - 0 - - - - - 0 - 43 - - - - - 16777215 - 43 - - - - TimeStep - - - - - - - - - - - - Sim. Parameters - - - - - - - - - - - - PRECIP_ICEPT_USER - - - - - PRECIP_ICEPT_LAI - - - - - PRECIP_ICEPT_EXPLAI - - - - - PRECIP_ICEPT_NONE - - - - - PRECIP_ICEPT_HEDSTROM - - - - - - - - LakeStorage - - - - - - - - - - - - - SW_RAD_DEFAULT - - - - - SW_RAD_DATA - - - - - SW_RAD_UBCWM - - - - - SW_RAD_VALIANTZAS - - - - - SW_RAD_NONE - - - - - - - - SubdailyMethod - - - - - - - - - - - - - CLOUDCOV_NONE - - - - - CLOUDCOV_DATA - - - - - CLOUDCOV_UBCWM - - - - - - - - CatchmentRoute - - - - - - - - ROUTE_DUMP - - - - - ROUTE_DELAYED_FIRST_ORDER - - - - - ROUTE_GAMMA_CONVOLUTION - - - - - ROUTE_TRI_CONVOLUTION - - - - - ROUTE_RESERVOIR_SERIES - - - - - - - - Method - - - - - - - - - - - - - SUBDAILY_NONE - - - - - SUBDAILY_UBC - - - - - SUBDAILY_SIMPLE - - - - - - - - - - - - - - - PrecipIceptFract - - - - - - - Qt::LeftToRight - - - InterpolationMethod - - - - - - - SWRadiationMethod - - - - - - - - - - - - - POTMELT_DEGREE_DAY - - - - - POTMELT_NONE - - - - - POTMELT_EB - - - - - POTMELT_RESTRICTED - - - - - POTMELT_HBV - - - - - POTMELT_HBV_ROS - - - - - POTMELT_UBCWM - - - - - POTMELT_CRHM - - - - - POTMELT_HMETS - - - - - POTMELT_DATA - - - - - POTMELT_BLENDED - - - - - POTMELT_DD_RAIN - - - - - POTMELT_USACE - - - - - POTMELT_CRHM_EBSM - - - - - POTMELT_RILEY - - - - - - - - - - - - - - SW_CLOUD_CORR_NONE - - - - - SW_CLOUD_CORR_UBCWM - - - - - SW_CLOUD_CORR_DINGMAN - - - - - SW_CLOUD_CORR_ANNANDALE - - - - - - - - false - - - Filename - - - - - - - - - - - - - RECHARGE_NONE - - - - - RECHARGE_MODEL - - - - - RECHARGE_DATA - - - - - - - - SWCloudCorrect - - - - - - - OroTempCorrect - - - - - - - - - - - - - EULER - - - - - STANDARD - - - - - ORDERED_SERIES - - - - - ITER_HEUN - - - - - - - - - - - - - - WINDVEL_CONSTANT - - - - - WINDVEL_DATA - - - - - WINDVEL_UBCWM - - - - - WINDVEL_UBC - - - - - WINDVEL_UBC_MOD - - - - - WINDVEL_SQRT - - - - - WINDVEL_LOG - - - - - - - - - ROUTE_MUSKINGUM - - - - - ROUTE_MUSKINGUM_CUNGE - - - - - ROUTE_STORAGE_COEFF - - - - - ROUTE_PLUG_FLOW - - - - - ROUTE_DIFFUSIVE_WAVE - - - - - ROUTE_DIFFUSIVE_VARY - - - - - ROUTE_HYDROLOGIC - - - - - ROUTE_NONE - - - - - ROUTE_EXTERNAL - - - - - ROUTE_TVD - - - - - - - - - - - - - - RELHUM_CONSTANT - - - - - RELHUM_DATA - - - - - RELHUM_MINDEWPT - - - - - - - - WindspeedMethod - - - - - - - AirPressureMethod - - - - - - - MonthlyInterpolationMethod - - - - - - - Evaporation - - - - - - - PotentialMeltMethod - - - - - - - - - - - - - SURFACE_WATER - - - - - LAKE_STORAGE - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Optional parameters - - - - - - - - - - - - - OROCORR_NONE - - - - - OROCORR_HBV - - - - - OROCORR_UBCWM - - - - - OROCORR_UBCWM2 - - - - - OROCORR_PRMS - - - - - OROCORR_SIMPLELAPSE - - - - - - - - - PET_HARGREAVES_1985 - - - - - PET_DATA - - - - - PET_OUDIN - - - - - PET_PENMAN_MONTEITH - - - - - PET_PENMAN_COMBINATION - - - - - PET_PRIESTLEY_TAYLOR - - - - - PET_HARGREAVES - - - - - PET_HAMON - - - - - PET_TURC_1961 - - - - - PET_MAKKINK_1957 - - - - - PET_FROMMONTHLY - - - - - PET_MONTHLY_FACTOR - - - - - PET_MOHYSE - - - - - PET_CONSTANT - - - - - PET_BLENDED - - - - - PET_JENSEN_HAISE - - - - - PET_SHUTTLEWORTH_WALLACE - - - - - PET_PENMAN_SIMPLE33 - - - - - PET_PENMAN_SIMPLE39 - - - - - PET_LINACRE - - - - - PET_GRANGERGRAY - - - - - - - - - - - - - - INTERP_NEAREST_NEIGHBOR - - - - - INTERP_INVERSE_DISTANCE - - - - - INTERP_INVERSE_DISTANCE_ELEVATION - - - - - INTERP_AVERAGE_ALL - - - - - INTERP_FROM_FILE - - - - - - - - - - - - - - OROCORR_NONE - - - - - OROCORR_HBV - - - - - OROCORR_UBCWM - - - - - OROCORR_UBCWM2 - - - - - OROCORR_SIMPLE - - - - - OROCORR_SIMPLELAPSE - - - - - - - - - - - - - - AIRPRESS_BASIC - - - - - AIRPRESS_CONST - - - - - AIRPRESS_DATA - - - - - AIRPRESS_UBC - - - - - - - - RainSnowFraction - - - - - - - Qt::LeftToRight - - - Routing - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - LWRadiationMethod - - - - - - - Calendar - - - - - - - OroPETCorrect - - - - - - - - - - - - - RAINSNOW_DINGMAN - - - - - RAINSNOW_DATA - - - - - RAINSNOW_UBC - - - - - RAINSNOW_UBCWM - - - - - RAINSNOW_HBV - - - - - RAINSNOW_HSPF - - - - - RAINSNOW_HARDER - - - - - RAINSNOW_THRESHOLD - - - - - - - - - - - - - - LW_RAD_DATA - - - - - LW_RAD_DEFAULT - - - - - LW_RAD_UBC - - - - - LW_RAD_UBCWM - - - - - LW_RAD_HSPF - - - - - LW_RAD_VALIANTZAS - - - - - LW_RAD_NONE - - - - - - - - - - - - - - PET_HARGREAVES_1985 - - - - - PET_DATA - - - - - PET_OUDIN - - - - - PET_PENMAN_MONTEITH - - - - - PET_PENMAN_COMBINATION - - - - - PET_PRIESTLEY_TAYLOR - - - - - PET_HARGREAVES - - - - - PET_HAMON - - - - - PET_TURC_1961 - - - - - PET_MAKKINK_1957 - - - - - PET_FROMMONTHLY - - - - - PET_MONTHLY_FACTOR - - - - - PET_MOHYSE - - - - - PET_CONSTANT - - - - - PET_BLENDED - - - - - PET_JENSEN_HAISE - - - - - PET_SHUTTLEWORTH_WALLACE - - - - - PET_PENMAN_SIMPLE33 - - - - - PET_PENMAN_SIMPLE39 - - - - - PET_LINACRE - - - - - PET_GRANGERGRAY - - - - - - - - - - - - - - OROCORR_NONE - - - - - OROCORR_HBV - - - - - OROCORR_UBCWM - - - - - OROCORR_UBCWM2 - - - - - OROCORR_SIMPLELAPSE - - - - - - - - CloudCoverMethod - - - - - - - RelativeHumidityMethod - - - - - - - OW_Evaporation - - - - - - - - - - - - - SW_CANOPY_CORR_NONE - - - - - SW_CANOPY_CORR_STATIC - - - - - SW_CANOPY_CORR_DYNAMIC - - - - - SW_CANOPY_CORR_UBCWM - - - - - - - - RechargeMethod - - - - - - - - - - - - - PROLEPTIC_GREGORIAN - - - - - JULIAN - - - - - GREGORIAN - - - - - STANDARD - - - - - NOLEAP - - - - - 365_DAY - - - - - ALL_LEAP - - - - - 366_DAY - - - - - - - - - - - - - - MONTHINT_UNIFORM - - - - - MONTHINT_LINEAR_MID - - - - - MONTHINT_LINEAR_FOM - - - - - MONTHINT_LINEAR_21 - - - - - - - - SWCanopyCorrect - - - - - - - OroPrecipCorrect - - - - - - - DirectEvaporation - - - - - - - SnowSuppressesPET - - - - - - - SuppressCompetitivePET - - - - - - - - Hydro. Processes - - - - - -1 - 43 - 1071 - 491 - - - - QAbstractScrollArea::AdjustToContents - - - 0 - - - 11 - - - false - - - false - - - - Process - - - - - Algorithm - - - - - From/HRU - - - - - To/SV - - - - - Conditional - - - - - Based - - - - - Comparison - - - - - Type - - - - - Mixing rate - - - - - Pct - - - - - Interbasin - - - - - - - 10 - 20 - 181 - 21 - - - - Add process - - - - - - 210 - 20 - 181 - 21 - - - - Remove selected process - - - - - - Transport cmd. - - - - - -1 - 43 - 1071 - 491 - - - - 5 - - - false - - - - Type - - - - - Constituent - - - - - Compartment - - - - - Conc/temp/flux - - - - - HRU group - - - - - - - 10 - 20 - 181 - 21 - - - - Add transport - - - - - - 210 - 20 - 191 - 21 - - - - Remove selected transport - - - - - - Optional I/O - - - - - - false - - - - - - - Qt::RightToLeft - - - CreateRVPTemplate - - - - - - - Qt::RightToLeft - - - rvc_filename - - - - - - - Qt::RightToLeft - - - WaterYearStartMonth - - - - - - - Qt::RightToLeft - - - OutputInterval - - - - - - - Qt::RightToLeft - - - SilentMode - - - - - - - Qt::RightToLeft - - - SuppressOutput - - - - - - - Qt::RightToLeft - - - OutputDirectory - - - - - - - false - - - 1 - - - 12 - - - 10 - - - - - - - false - - - Buffer size in MB - - - 99999999 - - - - - - - Qt::RightToLeft - - - SnapshotHydrograph - - - - - - - false - - - 999999.989999999990687 - - - - - - - Qt::RightToLeft - - - OutputDump - - - - - - - Qt::RightToLeft - - - EndPause - - - - - - - false - - - - - - - Qt::RightToLeft - - - rvt_filename - - - - - - - false - - - yyyy-MM-dd h:mm:ss - - - - - - - Qt::RightToLeft - - - DebugMode - - - - - - - - 0 - 212 - - - - - 0 - 492 - - - - QAbstractItemView::MultiSelection - - - - NASH_SUTCLIFFE - - - - - RMSE - - - - - PCT_BIAS - - - - - ABSERR - - - - - ABSMAX - - - - - PDIFF - - - - - TMVOL - - - - - RCOEF - - - - - NSC - - - - - RSR - - - - - R2 - - - - - CUMUL_FLOW - - - - - LOG_NASH - - - - - KLING_GUPTA - - - - - NASH_SUTCLIFFE_DER - - - - - RMSE_DER - - - - - KLING_GUPTA_DER - - - - - KLING_GUPTA_DEVIATION - - - - - MBF - - - - - R4MS4E - - - - - RTRMSE - - - - - RABSERR - - - - - PERSINDEX - - - - - NSE4 - - - - - NASH_SUTCLIFFE_RUN - - - - - - - - false - - - Frequency - - - 99999999 - - - - - - - Qt::RightToLeft - - - AssimilateStreamflow - - - - - - - Qt::RightToLeft - - - ReadLiveFile - - - - - - - false - - - - DEMANDBY_CONTRIB_AREA - - - - - DEMANDBY_MAX_CAPACITY - - - - - - - - Qt::RightToLeft - - - rvh_filename - - - - - - - Qt::RightToLeft - - - ReservoirDemandAllocation - - - - - - - false - - - - - - - false - - - Qt::TabFocus - - - QgsFileWidget::GetDirectory - - - - - - - EvaluationMetrics - - - - - - - false - - - - - - - Qt::RightToLeft - - - RunName - - - - - - - Qt::RightToLeft - - - AssimilateReservoirStage - - - - - - - false - - - - - - - Qt::RightToLeft - - - rvp_filename - - - - - - - Qt::RightToLeft - - - Chunksize - - - - - - - Qt::RightToLeft - - - WriteForcingFunctions - - - - - - - Qt::RightToLeft - - - false - - - WriteExhaustiveMB - - - - - - - Qt::RightToLeft - - - WriteEnsimFormat - - - - - - - Qt::RightToLeft - - - WriteEnergyStorage - - - - - - - Qt::RightToLeft - - - WriteDemandFile - - - - - - - Qt::RightToLeft - - - UseStopFile - - - - - - - Qt::RightToLeft - - - WriteMassBalanceFile - - - - - - - - Custom Output - - - - - 10 - 40 - 1041 - 431 - - - - - - - - - - - - - BY_BASIN - - - - - BY_HRU - - - - - BY_HRU_GROUP - - - - - BY_SB_GROUP - - - - - ENTIRE_WATERSHED - - - - - - - - false - - - 9999999 - - - - - - - - - - - - - AVERAGE - - - - - MAXIMUM - - - - - MINIMUM - - - - - RANGE - - - - - MEDIAN - - - - - QUARTILES - - - - - HISTOGRAM - - - - - - - - false - - - 9999999 - - - - - - - - - - - - - DAILY - - - - - MONTHLY - - - - - YEARLY - - - - - WATER_YEARLY - - - - - CONTINUOUS - - - - - - - - false - - - 9999999 - - - - - - - false - - - 9999999 - - - - - - - - - - - - - BY_BASIN - - - - - BY_HRU - - - - - BY_HRU_GROUP - - - - - BY_SB_GROUP - - - - - ENTIRE_WATERSHED - - - - - - - - - - - - - - DAILY - - - - - MONTHLY - - - - - YEARLY - - - - - WATER_YEARLY - - - - - CONTINUOUS - - - - - - - - - - - - - - BY_BASIN - - - - - BY_HRU - - - - - BY_HRU_GROUP - - - - - BY_SB_GROUP - - - - - ENTIRE_WATERSHED - - - - - - - - false - - - 9999999 - - - - - - - - 0 - 0 - - - - - 16777215 - 20 - - - - Time period - - - - - - - false - - - 9999999 - - - - - - - - - - - - - BY_BASIN - - - - - BY_HRU - - - - - BY_HRU_GROUP - - - - - BY_SB_GROUP - - - - - ENTIRE_WATERSHED - - - - - - - - - - - - - - DAILY - - - - - MONTHLY - - - - - YEARLY - - - - - WATER_YEARLY - - - - - CONTINUOUS - - - - - - - - - - - - - - AVERAGE - - - - - MAXIMUM - - - - - MINIMUM - - - - - RANGE - - - - - MEDIAN - - - - - QUARTILES - - - - - HISTOGRAM - - - - - - - - - - - - - - - - - DAILY - - - - - MONTHLY - - - - - YEARLY - - - - - WATER_YEARLY - - - - - CONTINUOUS - - - - - - - - - - - - - - - - - false - - - 9999999 - - - - - - - false - - - 9999999 - - - - - - - - - - - - - AVERAGE - - - - - MAXIMUM - - - - - MINIMUM - - - - - RANGE - - - - - MEDIAN - - - - - QUARTILES - - - - - HISTOGRAM - - - - - - - - - - - - - - AVERAGE - - - - - MAXIMUM - - - - - MINIMUM - - - - - RANGE - - - - - MEDIAN - - - - - QUARTILES - - - - - HISTOGRAM - - - - - - - - false - - - 9999999 - - - - - - - false - - - 9999999 - - - - - - - false - - - 9999999 - - - - - - - - - - - - - BY_BASIN - - - - - BY_HRU - - - - - BY_HRU_GROUP - - - - - BY_SB_GROUP - - - - - ENTIRE_WATERSHED - - - - - - - - - - - - - - AVERAGE - - - - - MAXIMUM - - - - - MINIMUM - - - - - RANGE - - - - - MEDIAN - - - - - QUARTILES - - - - - HISTOGRAM - - - - - - - - - - - - - - AVERAGE - - - - - MAXIMUM - - - - - MINIMUM - - - - - RANGE - - - - - MEDIAN - - - - - QUARTILES - - - - - HISTOGRAM - - - - - - - - - - - - - - BY_BASIN - - - - - BY_HRU - - - - - BY_HRU_GROUP - - - - - BY_SB_GROUP - - - - - ENTIRE_WATERSHED - - - - - - - - - - - - - - DAILY - - - - - MONTHLY - - - - - YEARLY - - - - - WATER_YEARLY - - - - - CONTINUOUS - - - - - - - - false - - - 9999999 - - - - - - - - - - false - - - 9999999 - - - - - - - - - - false - - - 9999999 - - - - - - - false - - - 9999999 - - - - - - - false - - - 9999999 - - - - - - - - - - false - - - 9999999 - - - - - - - false - - - 9999999 - - - - - - - - - - - - - DAILY - - - - - MONTHLY - - - - - YEARLY - - - - - WATER_YEARLY - - - - - CONTINUOUS - - - - - - - - false - - - 9999999 - - - - - - - - - - - - - DAILY - - - - - MONTHLY - - - - - YEARLY - - - - - WATER_YEARLY - - - - - CONTINUOUS - - - - - - - - false - - - 9999999 - - - - - - - - - - - - - BY_BASIN - - - - - BY_HRU - - - - - BY_HRU_GROUP - - - - - BY_SB_GROUP - - - - - ENTIRE_WATERSHED - - - - - - - - false - - - 9999999 - - - - - - - - - - - - - AVERAGE - - - - - MAXIMUM - - - - - MINIMUM - - - - - RANGE - - - - - MEDIAN - - - - - QUARTILES - - - - - HISTOGRAM - - - - - - - - Statistic - - - - - - - Min - - - - - - - Max - - - - - - - Bins - - - - - - - Variable - - - - - - - Spatial evaluation - - - - - - - - - - - 20 - 580 - 90 - 28 - - - - Write - - - - - - 960 - 580 - 90 - 28 - - - - Reset - - - - - - BasinMaker RVH - - - - - 10 - 0 - 641 - 21 - - - - <html><head/><body><p>Docker must be installed. Download and install docker : <a href="https://docs.docker.com/get-docker/"><span style=" text-decoration: underline; color:#0000ff;">https://docs.docker.com/get-docker/</span></a></p></body></html> - - - Qt::AutoText - - - true - - - Qt::TextBrowserInteraction - - - - - - 10 - 20 - 711 - 21 - - - - Linux users, make sure to add your user to the docker group by running sudo usermod -aG docker $USER - - - Qt::RichText - - - Qt::TextBrowserInteraction - - - - - - 60 - 580 - 90 - 28 - - - - Run - - - - - - 880 - 580 - 111 - 28 - - - - Delete image - - - - - - 0 - 50 - 1071 - 521 - - - - 1 - - - - Delineate lake-river routing product tools - - - - - - true - - - - - 0 - 0 - 593 - 1190 - - - - - - - - - - false - - - - - - - Point_of_interest_attributes - - - - - - - Define project spatial extent - - - - - - - Landuse (raster)* - - - - - - - Qt::TabFocus - - - *.shp - - - - - - - false - - - path of flow direction input dataset - - - - - - - using_dem - - - true - - - buttonGroup_2 - - - - - - - if k and c is provided, the path_bkfwidthdepth_polyline will not be used - - - K - - - - - - - Qt::LeftToRight - - - projected_epsg_code - - - - - - - false - - - Lat - - - - - - - Qt::TabFocus - - - - - - - DEM - - - - - - - false - - - - - - - the extent of provided polygon is used - - - using_provided_ply - - - buttonGroup - - - - - - - Bankfull width* - - - - - - - using_fdr - - - buttonGroup_2 - - - - - - - - - - false - - - 1000000.000000000000000 - - - - - - - if k and c is provided, the path_bkfwidthdepth_polyline will not be used - - - C - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - buffer_distance - - - - - - - 0 - - - 0 - - - Files location - - - - - - - false - - - id - - - - - - - The maximum RAM that BasinMaker will be allowed to use - - - Max memory (MB) - - - - - - - Add hydrology related attributes - - - - - - - Qt::TabFocus - - - *.shp - - - - - - - path of the point shapefile that indicate points of interest,which can include different observation gauges - - - Points of interest - - - - - - - the extent is defined by subbasins that are drainage to the provided watershed outlet subbasins ID in HydroBASINS product + + + AIRPRESS_CONST + + + + + AIRPRESS_DATA + + + + + AIRPRESS_UBC + + + + + + + + + + + + + + CLOUDCOV_NONE + + + + + CLOUDCOV_DATA + + + + + CLOUDCOV_UBCWM + + + + + + + + + + + + + + WINDVEL_CONSTANT + + + + + WINDVEL_DATA + + + + + WINDVEL_UBCWM + + + + + WINDVEL_UBC + + + + + WINDVEL_UBC_MOD + + + + + WINDVEL_SQRT + + + + + WINDVEL_LOG + + + + + + + + + PET_HARGREAVES_1985 + + + + + PET_DATA + + + + + PET_OUDIN + + + + + PET_PENMAN_MONTEITH + + + + + PET_PENMAN_COMBINATION + + + + + PET_PRIESTLEY_TAYLOR + + + + + PET_HARGREAVES + + + + + PET_HAMON + + + + + PET_TURC_1961 + + + + + PET_MAKKINK_1957 + + + + + PET_FROMMONTHLY + + + + + PET_MONTHLY_FACTOR + + + + + PET_MOHYSE + + + + + PET_CONSTANT + + + + + PET_BLENDED + + + + + PET_JENSEN_HAISE + + + + + PET_SHUTTLEWORTH_WALLACE + + + + + PET_PENMAN_SIMPLE33 + + + + + PET_PENMAN_SIMPLE39 + + + + + PET_LINACRE + + + + + PET_GRANGERGRAY + + + + + + + + + + + + + + SW_CLOUD_CORR_NONE + + + + + SW_CLOUD_CORR_UBCWM + + + + + SW_CLOUD_CORR_DINGMAN + + + + + SW_CLOUD_CORR_ANNANDALE + + + + + + + + Qt::LeftToRight + + + InterpolationMethod + + + + + + + SWRadiationMethod + + + + + + + MonthlyInterpolationMethod + + + + + + + + + + + + + PRECIP_ICEPT_USER + + + + + PRECIP_ICEPT_LAI + + + + + PRECIP_ICEPT_EXPLAI + + + + + PRECIP_ICEPT_NONE + + + + + PRECIP_ICEPT_HEDSTROM + + + + + + + + RechargeMethod + + + + + + + + + + + + + OROCORR_NONE + + + + + OROCORR_HBV + + + + + OROCORR_UBCWM + + + + + OROCORR_UBCWM2 + + + + + OROCORR_SIMPLELAPSE + + + + + + + + SuppressCompetitivePET + + + + + + + AirPressureMethod + + + + + + + + + + + + + EULER + + + + + STANDARD + + + + + ORDERED_SERIES + + + + + ITER_HEUN + + + + + + + + OroPETCorrect + + + + + + + + + + + + + PET_HARGREAVES_1985 + + + + + PET_DATA + + + + + PET_OUDIN + + + + + PET_PENMAN_MONTEITH + + + + + PET_PENMAN_COMBINATION + + + + + PET_PRIESTLEY_TAYLOR + + + + + PET_HARGREAVES + + + + + PET_HAMON + + + + + PET_TURC_1961 + + + + + PET_MAKKINK_1957 + + + + + PET_FROMMONTHLY + + + + + PET_MONTHLY_FACTOR + + + + + PET_MOHYSE + + + + + PET_CONSTANT + + + + + PET_BLENDED + + + + + PET_JENSEN_HAISE + + + + + PET_SHUTTLEWORTH_WALLACE + + + + + PET_PENMAN_SIMPLE33 + + + + + PET_PENMAN_SIMPLE39 + + + + + PET_LINACRE + + + + + PET_GRANGERGRAY + + + + + + + + PrecipIceptFract + + + + + + + OroPrecipCorrect + + + + + + + Method + + + + + + + + + + + + + LW_RAD_DATA + + + + + LW_RAD_DEFAULT + + + + + LW_RAD_UBC + + + + + LW_RAD_UBCWM + + + + + LW_RAD_HSPF + + + + + LW_RAD_VALIANTZAS + + + + + LW_RAD_NONE + + + + + + + + OW_Evaporation + + + + + + + + + + + + + OROCORR_NONE + + + + + OROCORR_HBV + + + + + OROCORR_UBCWM + + + + + OROCORR_UBCWM2 + + + + + OROCORR_SIMPLE + + + + + OROCORR_SIMPLELAPSE + + + + + + + + RainSnowFraction + + + + + + + + + + + + + PROLEPTIC_GREGORIAN + + + + + JULIAN + + + + + GREGORIAN + + + + + STANDARD + + + + + NOLEAP + + + + + 365_DAY + + + + + ALL_LEAP + + + + + 366_DAY + + + + + + + + false + + + Filename + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Optional parameters + + + Qt::AlignCenter + + + + + + + PotentialMeltMethod + + + + + + + DirectEvaporation + + + + + + + Evaporation + + + + + + + + + + + + + RAINSNOW_DINGMAN + + + + + RAINSNOW_DATA + + + + + RAINSNOW_UBC + + + + + RAINSNOW_UBCWM + + + + + RAINSNOW_HBV + + + + + RAINSNOW_HSPF + + + + + RAINSNOW_HARDER + + + + + RAINSNOW_THRESHOLD + + + + + + + + + + + + + + OROCORR_NONE + + + + + OROCORR_HBV + + + + + OROCORR_UBCWM + + + + + OROCORR_UBCWM2 + + + + + OROCORR_PRMS + + + + + OROCORR_SIMPLELAPSE + + + + + + + + + + + + + + POTMELT_DEGREE_DAY + + + + + POTMELT_NONE + + + + + POTMELT_EB + + + + + POTMELT_RESTRICTED + + + + + POTMELT_HBV + + + + + POTMELT_HBV_ROS + + + + + POTMELT_UBCWM + + + + + POTMELT_CRHM + + + + + POTMELT_HMETS + + + + + POTMELT_DATA + + + + + POTMELT_BLENDED + + + + + POTMELT_DD_RAIN + + + + + POTMELT_USACE + + + + + POTMELT_CRHM_EBSM + + + + + POTMELT_RILEY + + + + + + + + + ROUTE_MUSKINGUM + + + + + ROUTE_MUSKINGUM_CUNGE + + + + + ROUTE_STORAGE_COEFF + + + + + ROUTE_PLUG_FLOW + + + + + ROUTE_DIFFUSIVE_WAVE + + + + + ROUTE_DIFFUSIVE_VARY + + + + + ROUTE_HYDROLOGIC + + + + + ROUTE_NONE + + + + + ROUTE_EXTERNAL + + + + + ROUTE_TVD + + + + + + + + + + + + + + INTERP_NEAREST_NEIGHBOR + + + + + INTERP_INVERSE_DISTANCE + + + + + INTERP_INVERSE_DISTANCE_ELEVATION + + + + + INTERP_AVERAGE_ALL + + + + + INTERP_FROM_FILE + + + + + + + + + + + + + + SW_CANOPY_CORR_NONE + + + + + SW_CANOPY_CORR_STATIC + + + + + SW_CANOPY_CORR_DYNAMIC + + + + + SW_CANOPY_CORR_UBCWM + + + + + + + + SnowSuppressesPET + + + + + + + WindspeedMethod + + + + + + + Qt::LeftToRight + + + Routing + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + + SW_RAD_DEFAULT + + + + + SW_RAD_DATA + + + + + SW_RAD_UBCWM + + + + + SW_RAD_VALIANTZAS + + + + + SW_RAD_NONE + + + + + + + + LWRadiationMethod + + + + + + + + + + + + + SURFACE_WATER + + + + + LAKE_STORAGE + + + + + + + + LakeStorage + + + + + + + SWCanopyCorrect + + + + + + + OroTempCorrect + + + + + + + SubdailyMethod + + + + + + + + + + + + + RELHUM_CONSTANT + + + + + RELHUM_DATA + + + + + RELHUM_MINDEWPT + + + + + + + + Calendar + + + + + + + + + + + + + RECHARGE_NONE + + + + + RECHARGE_MODEL + + + + + RECHARGE_DATA + + + + + + + + + + + + + + SUBDAILY_NONE + + + + + SUBDAILY_UBC + + + + + SUBDAILY_SIMPLE + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Hydro. processes + + + + + + + Process + + + + + Algorithm + + + + + From + + + + + + + + + + To + + + + + + + + + + Conditional + + + + + Based on + + + + + Comparison + + + + + Type + + + + + Mixing rate + + + + + Pct + + + + + Interbasin + + + + + + + + + 180 + 0 + + + + Remove selected process + + + + + + + + 180 + 0 + + + + Add process + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Transport cmd. + + + + + + Remove selected transport + + + + + + + + Type + + + + + Constituent + + + + + Compartment + + + + + Conc/temp/flux + + + + + HRU group + + + + + + + + + 180 + 0 + + + + Add transport + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Optional I/O + + + + + + true + + + + + 0 + 0 + 905 + 639 + + + + + + + Qt::RightToLeft + + + Chunksize + + + + + + + Qt::RightToLeft + + + rvt_filename + + + + + + + false + + + + + + + false + + + yyyy-MM-dd h:mm:ss + + + + + + + Qt::RightToLeft + + + OutputInterval + + + + + + + false + + + + + + + false + + + + DEMANDBY_CONTRIB_AREA + + + + + DEMANDBY_MAX_CAPACITY + + + + + + + + false + + + + + + + Qt::RightToLeft + + + ReadLiveFile + + + + + + + Qt::RightToLeft + + + rvp_filename + + + + + + + Qt::RightToLeft + + + OutputDirectory + + + + + + + Qt::RightToLeft + + + RunName + + + + + + + false + + + Frequency + + + 99999999 + + + + + + + false + + + Qt::TabFocus + + + QgsFileWidget::GetDirectory + + + + + + + EvaluationMetrics + + + + + + + false + + + Buffer size in MB + + + 99999999 + + + + + + + Qt::RightToLeft + + + ReservoirDemandAllocation + + + + + + + Qt::RightToLeft + + + OutputDump + + + + + + + false + + + 999999.989999999990687 + + + + + + + Qt::RightToLeft + + + rvh_filename + + + + + + + false + + + + + + + false + + + 1 + + + 12 + + + 10 + + + + + + + false + + + + + + + Qt::RightToLeft + + + WaterYearStartMonth + + + + + + + Qt::RightToLeft + + + rvc_filename + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + QAbstractItemView::MultiSelection + + + false + + + + NASH_SUTCLIFFE + + + + + RMSE + + + + + PCT_BIAS + + + + + ABSERR + + + + + ABSMAX + + + + + PDIFF + + + + + TMVOL + + + + + RCOEF + + + + + NSC + + + + + RSR + + + + + R2 + + + + + CUMUL_FLOW + + + + + LOG_NASH + + + + + KLING_GUPTA + + + + + NASH_SUTCLIFFE_DER + + + + + RMSE_DER + + + + + KLING_GUPTA_DER + + + + + KLING_GUPTA_DEVIATION + + + + + MBF + + + + + R4MS4E + + + + + RTRMSE + + + + + RABSERR + + + + + PERSINDEX + + + + + NSE4 + + + + + NASH_SUTCLIFFE_RUN + + + + + DIAG_YEARS_OF_RECORD + + + + + + + + + + + Qt::RightToLeft + + + WriteForcingFunctions + + + + + + + Qt::RightToLeft + + + NoisyMode + + + + + + + Qt::RightToLeft + + + WriteMassBalanceFile + + + + + + + Qt::RightToLeft + + + CreateRVPTemplate + + + + + + + Qt::RightToLeft + + + WriteEnsimFormat + + + + + + + Qt::RightToLeft + + + EndPause + + + + + + + Qt::RightToLeft + + + SilentMode + + + + + + + Qt::RightToLeft + + + WriteMassLoadings + + + + + + + Qt::RightToLeft + + + DebugMode + + + + + + + Qt::RightToLeft + + + AssimilateReservoirStage + + + + + + + Qt::RightToLeft + + + AssimilateStreamflow + + + + + + + Qt::RightToLeft + + + false + + + WriteExhaustiveMB + + + + + + + Qt::RightToLeft + + + WriteEnergyStorage + + + + + + + Qt::RightToLeft + + + WriteDemandFile + + + + + + + Qt::RightToLeft + + + SuppressOutput + + + + + + + Qt::RightToLeft + + + SnapshotHydrograph + + + + + + + Qt::RightToLeft + + + UseStopFile + + + + + + + + + + + + + + + Custom output + + + + + + + 180 + 0 + + + + Add output + + + + + + + + 180 + 0 + + + + Remove output + + + + + + + + Time period + + + + + Statistic + + + + + Min + + + + + Max + + + + + Bins + + + + + Option + + + + + Variable 1 + + + + + Variable 2 + + + + + Spatial evaluation + + + + + Filename + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + 180 + 0 + - using_hybasin + Write - - buttonGroup - - - + + Qt::Horizontal @@ -3989,980 +2688,2725 @@ - - - - false - - - - - - - Qt::StrongFocus - - - *.shp - - - - - - - bkfwd_attributes - - - - - - - the extent of input dem is used + + + + + 180 + 0 + - using_dem - - - true + Reset - - buttonGroup - - - - - false + + + + + + + + + 0 + + + 0 + + + + + + + + 0 + + + + Delineate lake-river routing product tools + + + + + + true + + + + + 0 + 0 + 905 + 1315 + + + + + + + Soil + + + + + + + false + + + + + + + false + + + + + + + using_dem + + + true + + + buttonGroup_2 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::TabFocus + + + *.shp + + + + + + + false + + + Qt::TabFocus + + + path_to_hydrobasin_polygon + + + *.shp + + + + + + + + + + Lakes + + + + + + + the extent is defined by subbasins that are drainage to the provided watershed outlet subbasins ID in HydroBASINS product + + + using_hybasin + + + buttonGroup + + + + + + + false + + + Qt::TabFocus + + + path_to_spatial_extent_polygon + + + *.shp + + + + + + + + + + false + + + 1000000.000000000000000 + + + + + + + false + + + Qt::TabFocus + + + *.csv + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + using_fdr + + + buttonGroup_2 + + + + + + + + + + false + + + Lon + + + + + + + Qt::TabFocus + + + + + + + false + + + The unit is the same with the spatial unit of input DEM + + + 8 + + + 999999.999990000040270 + + + + + + + false + + + + + + + false + + + id + + + + + + + true + + + 8 + + + 99999.999999000006937 + + + + + + + if k and c is provided, the path_bkfwidthdepth_polyline will not be used + + + C + + + + + + + non_connected_lake_area_threshold + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + + + + + true + + + + + + 8 + + + 999999999.999989986419678 + + + 9000.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + connected_lake_area_threshold + + + + + + + false + + + + + + + path of the point shapefile that indicate points of interest,which can include different observation gauges + + + Points of interest + + + + + + + false + + + 1000000.000000000000000 + + + + + + + false + + + 32187 + + + + + + + flow accumulation thresthold + + + fac_threshold + + + + + + + mode + + + + + + + false + + + Lat + + + + + + + Qt::TabFocus + + + *.shp + + + + + + + Qt::StrongFocus + + + + + + + Qt::StrongFocus + + + *.shp + + + + + + + Qt::TabFocus + + + *.shp + + + + + + + DEM + + + + + + + Qt::TabFocus + + + *.shp + + + + + + + the extent of input dem is used + + + using_dem + + + true + + + buttonGroup + + + + + + + false + + + + + + + the extent is defined by the watershed generated from input dem and the watershed outlet coordinates + + + using_outlet_pt + + + buttonGroup + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Landuse (raster) + + + + + + + if k and c is provided, the path_bkfwidthdepth_polyline will not be used + + + K + + + + + + + true + + + 8 + + + 99999.999999000006937 + + + + + + + false + + + + + + + Point_of_interest_attributes + + + + + + + Bankfull width + + + + + + + Qt::LeftToRight + + + projected_epsg_code + + + + + + + false + + + path of flow direction input dataset + + + + + + + lake_attributes + + + + + + + the extent of provided polygon is used + + + using_provided_ply + + + buttonGroup + + + + + + + buffer_distance + + + + + + + false + + + + + + + The maximum RAM that BasinMaker will be allowed to use + + + Max memory (MB) + + + + + + + 524 + + + 64000 + + + 2 + + + QAbstractSpinBox::DefaultStepType + + + 4096 + + + 10 + + + + + + + + + + bkfwd_attributes + + + + + + + Landuse (polygons) + + + + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + path_land_use_and_manning_n_table + + + + + + + Qt::TabFocus + + + QgsFileWidget::GetDirectory + + + + + + + Output folder + + + + + + + 0 + + + 0 + + + Mandatory files + + + Qt::AlignCenter + + + + + + + Optional files + + + Qt::AlignCenter + + + + + + + Define project spatial extent + + + Qt::AlignCenter + + + + + + + Delineate routing structure without lakes + + + Qt::AlignCenter + + + + + + + Add lake and obs control points + + + Qt::AlignCenter + + + + + + + Add hydrology related attributes + + + Qt::AlignCenter + + + + + + + + + + + + Postprocessing tools + + + + + + true + + + + + 0 + 0 + 425 + 361 + + + + + + + comma seperated + + + + + + + non_connected_lake_area_threshold + + + + + + + minimum_subbasin_drainage_area + + + + + + + + + + path_soil_info + + + + + + + Filter lakes + + + Qt::AlignCenter + + + + + + + model_name + + + + + + + selected_lake_ids + + + + + + + 10000000000000000.000000000000000 + + + + + + + Qt::TabFocus + + + *.csv + + + + + + + 10000000000000000.000000000000000 + + + + + + + Qt::TabFocus + + + *.csv + + + + + + + 10000000000000000.000000000000000 + + + + + + + path_veg_info + + + + + + + path_landuse_info + + + + + + + connected_lake_area_threshold + + + + + + + Increase catchment area + + + Qt::AlignCenter + + + + + + + Generate HRUs + + + Qt::AlignCenter + + + + + + + Generate Raven input files + + + Qt::AlignCenter + + + + + + + + + + + + + + + + + + + + + + 180 + 0 + - - - - - lake_attributes + Run - - - - true - - - 8 - - - 99999.999999000006937 + + + + + 180 + 0 + - - - - - connected_lake_area_threshold - - - - - - - Qt::TabFocus - - - QgsFileWidget::GetDirectory - - - - - - - true - - - 8 - - - 99999.999999000006937 + Delete image - - - - Lakes* + + + + Qt::Horizontal - - - - - - path_land_use_and_manning_n_table + + + 40 + 20 + - + - - - - false - - - 1000000.000000000000000 + + + + + + + + + 0 + + + 0 + + + + + *.txt + + + QgsFileWidget::SaveFile + + + + + + + HRUs file + + + + + + + *.shp + + + + + + + NetCDF file + + + + + + + id + + + + + + + Qt::Horizontal + + + + 731 + 20 + + + + + + + + lon + + + + + + + lat + + + + + + + rlon + + + + + + + false + + + + + + + *.nc *.nc4 *.shp + + + + + + + Dim name longitude (x) + + + + + + + + 0 + 20 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Qt::LeftToRight - - - - - Add lake and obs control points + Use gauge ID + + buttonGroup_3 + - - - - false + + + + Qt::LeftToRight - - - - - Output folder + Use subbasin ID - - - - - + true - - - - - 8 - - - 999999999.999989986419678 - - - 9000.000000000000000 - - - - - - - false - - - - - - - - - - *Optional layers - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - Qt::TabFocus - - - path_to_hydrobasin_polygon - - - *.shp - + + buttonGroup_3 + - - - - false - - - 32187 + + + + + + + rlat + + + + + + + Output path + + + + + + + Var name latitude (y) + + + + + + + QFrame::StyledPanel + + + QFrame::Plain + + + + + + + 180 + 0 + - - - - - mode + Run - - - - Qt::TabFocus + + + + + 180 + 0 + - - *.shp + + Delete image - - - - false + + + + Qt::Horizontal - - - - - - false + + + 40 + 20 + - + - - - - non_connected_lake_area_threshold + + + + + + + Shapefile attribute + + + + + + + Var name longitude (x) + + + + + + + Dim name latitude (y) + + + + + + + + + + + + 0 + + + 0 + + + + + true + + + 0 + + + + DPPHC + + + + + + true + + + + + 0 + 0 + 905 + 891 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Output file + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Search + + + + + + + true + + + + + + + false + + + Download + + + + + + + Process + + + + + + + + 2030 + 1 + 1 + + + + + + + + + + + + + + + Region + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Output file + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + false + + + Create layer + + + + + + + Qt::Vertical + + + + 20 + 150 + + + + + + + + true + + + + + + + Download station data + + + Qt::AlignCenter + + + + + + + End date + + + + + + + Generate points of interest layer + + + Qt::AlignCenter + + + + + + + Start date + + + + + + + + + + Current IDs + + + + + + + Municipality + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + River or lake + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + *.txt + + + + + + + Fetch date range + + + + + + + Input file + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + *.rvt + + + QgsFileWidget::SaveFile + + + + + + + *.rvt + + + QgsFileWidget::SaveFile + + + + + + + + 16777215 + 33 + + + + Station search + + + Qt::AlignCenter + + + 0 + + + + + + + true + + + + + + + Process local file + + + Qt::AlignCenter + + + + + + + + 0 + 100 + + + + + + + true + + + + + + + Station ID + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + + 16777215 + 75 + + + + Qt::ScrollBarAsNeeded + + + Qt::ScrollBarAlwaysOff + + + true + + + No IDs + + + + + + + + + + + + Water office + + + + + + true + + + + + 0 + 0 + 337 + 932 + + + + + + + false + + + Create layer + + + + + + + Generate points of interest layer + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Start date + + + + + + + + + + false + + + Download + + + + + + + + + + Current IDs + + + + + + + Download station data + + + Qt::AlignCenter + + + + + + + Process + + + + + + + + 2030 + 1 + 1 + + + + + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Station ID + + + + + + + Input file + + + + + + + + + + Output file + + + + + + + Fetch date range + + + + + + + Station name + + + true + + + buttonGroup_4 + + + + + + + Output file + + + + + + + *.rvt + + + QgsFileWidget::SaveFile + + + + + + + *.rvt + + + QgsFileWidget::SaveFile + + + + + + + + 0 + 100 + + + + true + + + + + + + Regulation + + + + + + + Province + + + buttonGroup_4 + + + + + + + + All + + + + + Regulated + + + + + Natural + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + *.csv + + + + + + + + All + + + + + Active + + + + + Discontinued + + + + + + + + Search + + + + + + + Station status + + + + + + + Station search + + + Qt::AlignCenter + + + + + + + Process local file + + + Qt::AlignCenter + + + + + + + End date + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + + 16777215 + 75 + + + + true + + + No IDs + + + + + + + + + + + + + + + + + 0 + + + 0 + + + + + true + + + + + 0 + 0 + 951 + 760 + + + + + + + DEM + + + + + + + *.zip + + + QgsFileWidget::GetDirectory + + + + + + + Flow direction + + + + + + + *.zip + + + QgsFileWidget::GetDirectory + + + + + + + Lakes + + + + + + + *.zip + + + QgsFileWidget::GetDirectory + + + + + + + Bankfull width + + + + + + + *.tgz + + + QgsFileWidget::GetDirectory + + + + + + + Landuse + + + + + + + *.tif + + + QgsFileWidget::GetDirectory + + + + + + + Soil + + + + + + + *.zip + + + QgsFileWidget::GetDirectory + + + + + + + + + + + + + + 0 + + + + + + + Download + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Use the same paths as above + + + + + + + Clip layer + + + + + + + *.shp + + + + + + + DEM + + + + + + + *.tif + + + + + + + Flow direction + + + + + + + *.tif + + + + + + + Lakes + + + + + + + *.shp + + + + + + + Bankfull width + + + + + + + *.shp + + + + + + + Landuse + + + + + + + *.tif;; *.shp + + + + + + + Soil + + + + + + + *.shp + + + + + + + + + + + + + + 0 + + + + + + + Process + + + + + + + Download data + + + Qt::AlignCenter + + + + + + + Data processing + + + Qt::AlignCenter + + + + + + + + + + + + + 0 + + + 0 + + + + + + + + Path where to save the results - - - - - Delineate routing structure without lakes + Output directory - - + + - flow accumulation thresthold + Path to the Raven executable (Raven.exe) - fac_threshold - - - - - - - false + Raven executable location - - - - false - - - Qt::TabFocus - + + - path_to_spatial_extent_polygon - - - *.shp - - - - - - - Qt::StrongFocus + Must be the same as :RunName in .rvi file - - - - - Soil + RunName - - - - false - - - Qt::TabFocus + + + + Path to the model folder - - *.csv + + QgsFileWidget::GetDirectory - - - - false - - - Lon + + + + Must be the same as :RunName in .rvi file - - - Landuse (polygons) - - - - - - - 524 - - - 64000 - - - 2 - - - QAbstractSpinBox::DefaultStepType - - - 4096 + + + The name of the model - - 10 + + File name prefix - - - - Qt::TabFocus + + + + Path to the Raven executable (Raven.exe) - *.shp + *.exe - - - - Qt::Horizontal + + + + The name of the model - - - 40 - 20 - + + e.g. model for model.rvi - - - - + - - - - false - + + - The unit is the same with the spatial unit of input DEM - - - 8 + Path to the model folder - - 999999.999990000040270 + + Input directory - - + + - the extent is defined by the watershed generated from input dem and the watershed outlet coordinates + Path where to save the results - - using_outlet_pt + + QgsFileWidget::GetDirectory - - buttonGroup - - - - - - - - - - Postprocessing tools - - - - - - true - - - - - 0 - 0 - 400 - 366 - - - - - - - path_soil_info - + + + + + + + Run Raven model + + + + + + + Draw hydrograph + + + + + + + Auto fill rvp template + + + + + + + Ravenview + + + + - + + + + + + + + + 0 + + + 0 + + + + + - connected_lake_area_threshold + Placeholder login + + + Qt::AlignCenter - - - - 10000000000000000.000000000000000 + + + + Qt::Vertical - + + + 20 + 40 + + + - - - - 10000000000000000.000000000000000 + + + + false + + + QLineEdit::PasswordEchoOnEdit - - + + - path_landuse_info + Containers + + + Qt::AlignCenter - - + + - path_veg_info + Password - - - - Qt::TabFocus + + + + - - *.csv + + Qt::AlignCenter - - + + - Generate Raven input files + Image - - - - 10000000000000000.000000000000000 - + + + + + + + + 0 + 0 + + + + + 160 + 16777215 + + + + Save + + + + - - + + - non_connected_lake_area_threshold + Menu bar style - - - - comma seperated - + + + + + Default + + + + + Collapsed + + - - - - selected_lake_ids - + + + + + scriptbash/qraven:latest + + + + + scriptbash/qraven_arm:latest + + - - + + - Increase catchment area + Miscellaneous + + + Qt::AlignCenter - - - - Qt::TabFocus - - - *.csv - + + + + + Docker + + + + + Podman + + - - + + - Filter lakes + Username - - - - Qt::TabFocus - - - *.csv + + + + Containerization software - - - - Generate HRUs + + + + false - - - - minimum_subbasin_drainage_area + + + + Qt::Vertical - + + + 20 + 40 + + + - - + + - model_name + Reset behavior - - + + + + + Full + + + + + Partial + + + - - - - - - - - - GridWeights - - - - - - false - - - - - - - HRUs file - - - - - - - lat - - - - - - - id - - - - - - - rlon - - - - - - - Var name latitude (y) - - - - - - - Output path - - - - - - - NetCDF file - - - - - - - Var name longitude (x) - - - - - - - Shapefile attribute - - - - - - - *.shp - - - - - - - QFrame::StyledPanel - - - QFrame::Plain - - - - - 50 - 30 - 85 - 28 - - - - Run - - - - - - 880 - 30 - 111 - 28 - - - - Delete image - - - - - - - - - 0 - 20 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Qt::LeftToRight - - - Use gauge ID - - - buttonGroup_3 - - - - - - - Qt::LeftToRight - - - Use subbasin ID - - - true - - - buttonGroup_3 - - - - - - - - - - rlat - - - - - - - lon - - - - - - - Dim name longitude (x) - - - - - - - *.nc *.nc4 *.shp - - - - - - - *.txt - - - QgsFileWidget::SaveFile - - - - - - - Dim name latitude (y) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - Run Model - - - - - - Run Raven Model - - - - - - - Auto fill rvp template - - - - - - - RavenView - - - - - - - Draw hydrograph - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Path to the model folder - - - Input directory - - - - - - - Path to the model folder - - - QgsFileWidget::GetDirectory - - - - - - - Path where to save the results - - - Output directory - - - - - - - Path where to save the results - - - QgsFileWidget::GetDirectory - - - - - - - Path to the Raven executable (Raven.exe) - - - Raven executable location - - - - - - - Path to the Raven executable (Raven.exe) - - - *.exe - - - - - - - The name of the model - - - File name prefix - - - - - - - The name of the model - - - e.g. model for model.rvi - - - - - - - Must be the same as :RunName in .rvi file - - - RunName - - - - - - - Must be the same as :RunName in .rvi file - - - - - - - - - - - - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - + + + @@ -4974,145 +5418,12 @@
qgsfilewidget.h
- - tabWidget - tabWidget - combo_catchment - combo_routing - combo_evapo - combo_method - combo_interpo - txt_interpofile - combo_rainsnowfrac - combo_owevapo - combo_oroprecip - combo_orotemp - combo_oropet - combo_cloudcover - combo_airpressure - combo_potentialmelt - combo_monthlyinterpo - combo_swradation - combo_swcanopy - combo_swcloud - combo_lwradation - combo_windspeed - combo_relhumidity - combo_precipicept - combo_recharge - combo_subdaily - combo_calendar - chk_runname - txt_runname - combo_time1 - combo_stat1 - txt_var1 - combo_eval1 - combo_time2 - combo_stat2 - txt_var2 - combo_eval2 - combo_time3 - combo_stat3 - txt_var3 - combo_eval3 - combo_time4 - combo_stat4 - txt_var4 - combo_eval4 - combo_time5 - combo_stat5 - txt_var5 - combo_eval5 - combo_time6 - combo_stat6 - txt_var6 - combo_eval6 - combo_time7 - combo_stat7 - txt_var7 - combo_eval7 - btn_write - tabWidget_2 - scrollArea - file_dem - file_landusepoly - file_landuserast - file_lakes - file_bankfullwidth - file_soil - file_pointsinterest - spin_ram - rb_modedem - rb_modehybasin - rb_outletpt - txt_outletlat - txt_outletlon - rb_providedply - file_providedply - spin_buffer - spin_facthreshold - rb_dem - rb_fdr - spin_conlakearea - spin_nonconlakearea - chk_epsgcode - txt_epsgcode - spin_kcoef - spin_ccoef - file_landusemanning - file_outputfolder - scrollArea_2 - spin_filterconnectedlakes - spin_filternonconnectedlakes - txt_selectedlakeid - spin_minsubbasinarea - file_pathlanduseinfo - file_pathsoilinfo - file_pathveginfo - txt_modelname - btn_dockerrun - btn_dockerrm - file_hybasin - - - - button_box - accepted() - QRavenDialogBase - accept() - - - 29 - 619 - - - 20 - 20 - - - - - button_box - rejected() - QRavenDialogBase - reject() - - - 29 - 619 - - - 20 - 20 - - - - + - + +