Skip to content

Commit 977f306

Browse files
authored
Merge pull request #23 from ar-siddiqui/feature/version_1.3
Feature/version 1.3
2 parents bb9613b + 0302398 commit 977f306

11 files changed

Lines changed: 52 additions & 318 deletions

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# vs code files
2-
.vscode/settings.json
1+
32

43
# .pyc files
54
*.pyc

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"workbench.colorTheme": "Solarized Dark"
3+
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ This algorithm generates Curve Number layer for the given Area of Interest withi
2020
## Outputs
2121

2222
- NLCD Land Cover Vector:
23-
NLCD 2016 Land Cover Dataset Vectorized
23+
NLCD 2019 Land Cover Dataset Vectorized
2424

2525
- NLCD Land Cover Raster:
26-
NLCD 2016 Land Cover Dataset
26+
NLCD 2019 Land Cover Dataset
2727

2828
- NLCD Impervious Surface Raster:
29-
NLCD 2016 Impervious Surface Dataset
29+
NLCD 2019 Impervious Surface Dataset
3030

3131
- Soil Layer:
3232
SSURGO Extended Soil Dataset
@@ -38,7 +38,7 @@ This algorithm generates Curve Number layer for the given Area of Interest withi
3838

3939
Algorithm author: Abdul Raheem Siddiqui
4040
Help author: Abdul Raheem Siddiqui
41-
Algorithm version: 1.2
41+
Algorithm version: 1.3
4242
Contact email: ars.work.ce@gmail.com
4343

4444
Disclaimer: The curve number generated with this algorithm is a high level estimate and should not be used for detailed modeling or construction projects.

README.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Certain Soils are categorized as dual category in SSURGO dataset. They have Hydr
1818
Outputs
1919

2020
NLCD Land Cover Raster
21-
NLCD 2016 Land Cover Dataset
21+
NLCD 2019 Land Cover Dataset
2222

2323
NLCD Land Cover Vector
24-
NLCD 2016 Land Cover Dataset Vectorized
24+
NLCD 2019 Land Cover Dataset Vectorized
2525

2626
NLCD Impervious Surface Raster
27-
NLCD 2016 Impervious Surface Dataset
27+
NLCD 2019 Impervious Surface Dataset
2828

2929
Soil Layer
3030
SSURGO Extended Soil Dataset
@@ -35,6 +35,6 @@ Generated Curve Number Layer based on Land Cover and HSG values.
3535

3636
Algorithm author: Abdul Raheem Siddiqui
3737
Help author: Abdul Raheem Siddiqui
38-
Algorithm version: 1.2
38+
Algorithm version: 1.3
3939
Contact email: ars.work.ce@gmail.com
4040
Disclaimer: The curve number generated with this algorithm is a high level estimate and should not be used for detailed modeling or construction projects.

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"""
2424

2525
__author__ = "Abdul Raheem Siddiqui"
26-
__date__ = "2021-06-19"
26+
__date__ = "2021-08-04"
2727
__copyright__ = "(C) 2021 by Abdul Raheem Siddiqui"
2828

2929

curve_number_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"""
2424

2525
__author__ = "Abdul Raheem Siddiqui"
26-
__date__ = "2021-06-19"
26+
__date__ = "2021-08-04"
2727
__copyright__ = "(C) 2021 by Abdul Raheem Siddiqui"
2828

2929
# This will get replaced with a git SHA1 when you do a git archive

curve_number_generator_algorithm.py

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from qgis.PyQt.QtGui import QIcon
3131
from qgis.PyQt.QtCore import QCoreApplication, QVariant
3232
from qgis.core import (
33+
QgsApplication,
3334
QgsProcessing,
3435
QgsProcessingAlgorithm,
3536
QgsProcessingParameterFeatureSource,
@@ -54,6 +55,8 @@
5455

5556
cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0]
5657
sys.path.append(cmd_folder)
58+
qgis_settings_path = QgsApplication.qgisSettingsDirPath().replace("\\", "/")
59+
cn_log_path = os.path.join(qgis_settings_path, "curve_number_generator.log")
5760

5861
from cust_functions import (
5962
check_crs_acceptable,
@@ -62,14 +65,14 @@
6265
)
6366

6467
__author__ = "Abdul Raheem Siddiqui"
65-
__date__ = "2021-06-19"
68+
__date__ = "2021-08-04"
6669
__copyright__ = "(C) 2021 by Abdul Raheem Siddiqui"
6770

6871
# This will get replaced with a git SHA1 when you do a git archive
6972

7073
__revision__ = "$Format:%H$"
7174

72-
curr_version = "1.2"
75+
curr_version = "1.3"
7376

7477

7578
class CurveNumberGeneratorAlgorithm(QgsProcessingAlgorithm):
@@ -141,13 +144,24 @@ def initAlgorithm(self, config=None):
141144
)
142145
)
143146

144-
# read usage
145-
with open(os.path.join(cmd_folder, "usage_counter.log"), "r+") as f:
146-
counter = int(f.readline())
147+
# read usage to add HTML Output option
147148

148-
# check if counter is milestone
149-
if (counter + 1) % 25 == 0:
150-
self.addOutput(QgsProcessingOutputHtml("Message", "Curve Number Generator"))
149+
try: # try-except because trivial feature
150+
if os.path.exists(cn_log_path):
151+
with open(cn_log_path, "r+") as f:
152+
counter = int(f.readline())
153+
154+
# check if counter is milestone
155+
if (counter + 1) % 25 == 0:
156+
self.addOutput(
157+
QgsProcessingOutputHtml("Message", "Curve Number Generator")
158+
)
159+
160+
else: # for the first time create file
161+
with open(cn_log_path, "w") as f:
162+
f.write(str(0))
163+
except:
164+
pass
151165

152166
# check if new version is available of the plugin
153167
try: # try except because this is not a critical part
@@ -252,11 +266,11 @@ def processAlgorithm(self, parameters, context, model_feedback):
252266

253267
# NLCD Impervious Raster
254268
if nlcd_rast_imp_output == True:
255-
request_URL = f"https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2016_Impervious_L48/ows?version=1.3.0&service=WMS&layers=NLCD_2016_Impervious_L48&styles&crs={str(EPSGCode)}&format=image/geotiff&request=GetMap&width={str(BBOX_width_int)}&height={str(BBOX_height_int)}&BBOX={str(xmin)},{str(ymin)},{str(xmax)},{str(ymax)}&"
269+
request_URL = f"https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Impervious_L48/ows?version=1.3.0&service=WMS&layers=NLCD_2019_Impervious_L48&styles&crs={str(EPSGCode)}&format=image/geotiff&request=GetMap&width={str(BBOX_width_int)}&height={str(BBOX_height_int)}&BBOX={str(xmin)},{str(ymin)},{str(xmax)},{str(ymax)}&"
256270

257271
# Download NLCD Impervious Raster
258272
try:
259-
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2016_Impervious_L48/ows"
273+
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Impervious_L48/ows"
260274
r = requests.head(ping_URL, verify=False)
261275
r.raise_for_status()
262276

@@ -341,11 +355,11 @@ def processAlgorithm(self, parameters, context, model_feedback):
341355
or nlcd_vect_output == True
342356
or nlcd_rast_output == True
343357
):
344-
request_URL = f"https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2016_Land_Cover_L48/ows?version=1.3.0&service=WMS&layers=NLCD_2016_Land_Cover_L48&styles&crs={str(EPSGCode)}&format=image/geotiff&request=GetMap&width={str(BBOX_width_int)}&height={str(BBOX_height_int)}&BBOX={str(xmin)},{str(ymin)},{str(xmax)},{str(ymax)}&"
358+
request_URL = f"https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Land_Cover_L48/ows?version=1.3.0&service=WMS&layers=NLCD_2019_Land_Cover_L48&styles&crs={str(EPSGCode)}&format=image/geotiff&request=GetMap&width={str(BBOX_width_int)}&height={str(BBOX_height_int)}&BBOX={str(xmin)},{str(ymin)},{str(xmax)},{str(ymax)}&"
345359

346360
# Download NLCD
347361
try:
348-
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2016_Land_Cover_L48/ows"
362+
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Land_Cover_L48/ows"
349363
r = requests.head(ping_URL, verify=False)
350364
r.raise_for_status()
351365

@@ -1029,7 +1043,7 @@ def processAlgorithm(self, parameters, context, model_feedback):
10291043
)
10301044

10311045
# log usage
1032-
with open(os.path.join(cmd_folder, "usage_counter.log"), "r+") as f:
1046+
with open(cn_log_path, "r+") as f:
10331047
counter = int(f.readline())
10341048
f.seek(0)
10351049
f.write(str(counter + 1))
@@ -1085,7 +1099,8 @@ def icon(self):
10851099
return icon
10861100

10871101
def shortHelpString(self):
1088-
return """<html><body><h2>Algorithm description</h2>
1102+
return """<html><body><a "href"="https://github.com/ar-siddiqui/curve_number_generator/wiki/Tutorials">Video Tutorials</a></h3>
1103+
<h2>Algorithm description</h2>
10891104
<p>This algorithm generates Curve Number layer for the given Area of Interest within the contiguous United States. It can also download Soil, Land Cover, and Impervious Surface datasets for the same area.</p>
10901105
<h2>Input parameters</h2>
10911106
<h3>Area Boundary</h3>
@@ -1100,16 +1115,16 @@ def shortHelpString(self):
11001115
If checked the algorithm will assume HSG A/B/C for each dual category soil.</p>
11011116
<h2>Outputs</h2>
11021117
<h3>NLCD Land Cover Vector</h3>
1103-
<p>NLCD 2016 Land Cover Dataset Vectorized</p>
1118+
<p>NLCD 2019 Land Cover Dataset Vectorized</p>
11041119
<h3>NLCD Land Cover Raster</h3>
1105-
<p>NLCD 2016 Land Cover Dataset</p>
1120+
<p>NLCD 2019 Land Cover Dataset</p>
11061121
<h3>NLCD Impervious Surface Raster</h3>
1107-
<p>NLCD 2016 Impervious Surface Dataset</p>
1122+
<p>NLCD 2019 Impervious Surface Dataset</p>
11081123
<h3>Soil Layer</h3>
11091124
<p>SSURGO Extended Soil Dataset </p>
11101125
<h3>Curve Number Layer</h3>
11111126
<p>Generated Curve Number Layer based on Land Cover and HSG values.</p>
1112-
<br><p align="right">Algorithm author: Abdul Raheem Siddiqui</p><p align="right">Help author: Abdul Raheem Siddiqui</p><p align="right">Algorithm version: 1.2</p><p align="right">Contact email: ars.work.ce@gmail.com</p><p>Disclaimer: The curve numbers generated with this algorithm are high level estimates and should be reviewed in detail before being used for detailed modeling or construction projects.</p></body></html>"""
1127+
<br><p align="right">Algorithm author: Abdul Raheem Siddiqui</p><p align="right">Help author: Abdul Raheem Siddiqui</p><p align="right">Algorithm version: 1.3</p><p align="right">Contact email: ars.work.ce@gmail.com</p><p>Disclaimer: The curve numbers generated with this algorithm are high level estimates and should be reviewed in detail before being used for detailed modeling or construction projects.</p></body></html>"""
11131128

11141129
def helpUrl(self):
11151130
return "mailto:ars.work.ce@gmail.com"

curve_number_generator_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"""
2424

2525
__author__ = "Abdul Raheem Siddiqui"
26-
__date__ = "2021-06-19"
26+
__date__ = "2021-08-04"
2727
__copyright__ = "(C) 2021 by Abdul Raheem Siddiqui"
2828

2929
# This will get replaced with a git SHA1 when you do a git archive

metadata.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
name=Curve Number Generator
77
qgisMinimumVersion=3.6
88
description=This plugin generates a Curve Number layer for the given Area of Interest within the contiguous United States. It can also download Soil, Land Cover, and Impervious Surface datasets for the same area.
9-
version=1.2
9+
version=1.3
1010
author=Abdul Raheem Siddiqui
1111
email=ars.work.ce@gmail.com
1212

@@ -21,10 +21,9 @@ repository=https://github.com/ar-siddiqui/curve_number_generator
2121

2222
hasProcessingProvider=yes
2323
# Uncomment the following line and add your changelog:
24-
changelog= Version 1.2 - 2021-06-19
25-
- Return layers in CRS of input layer
26-
- Check for the availability of the latest version of the plugin
27-
- Fix error in default CN lookup table
24+
changelog= Version 1.3 - 2021-08-04
25+
- Change NLCD LU to 2019
26+
- Change NLCD Impervious Raster to 2019
2827

2928

3029
# Tags are comma separated with spaces allowed

0 commit comments

Comments
 (0)