-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from ar-siddiqui/feature/version_1.3
Feature/version 1.3
- Loading branch information
Showing
11 changed files
with
52 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# vs code files | ||
.vscode/settings.json | ||
|
||
|
||
# .pyc files | ||
*.pyc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"workbench.colorTheme": "Solarized Dark" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,13 +20,13 @@ This algorithm generates Curve Number layer for the given Area of Interest withi | |
## Outputs | ||
|
||
- NLCD Land Cover Vector: | ||
NLCD 2016 Land Cover Dataset Vectorized | ||
NLCD 2019 Land Cover Dataset Vectorized | ||
|
||
- NLCD Land Cover Raster: | ||
NLCD 2016 Land Cover Dataset | ||
NLCD 2019 Land Cover Dataset | ||
|
||
- NLCD Impervious Surface Raster: | ||
NLCD 2016 Impervious Surface Dataset | ||
NLCD 2019 Impervious Surface Dataset | ||
|
||
- Soil Layer: | ||
SSURGO Extended Soil Dataset | ||
|
@@ -38,7 +38,7 @@ This algorithm generates Curve Number layer for the given Area of Interest withi | |
|
||
Algorithm author: Abdul Raheem Siddiqui | ||
Help author: Abdul Raheem Siddiqui | ||
Algorithm version: 1.2 | ||
Algorithm version: 1.3 | ||
Contact email: [email protected] | ||
|
||
Disclaimer: The curve number generated with this algorithm is a high level estimate and should not be used for detailed modeling or construction projects. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,13 @@ Certain Soils are categorized as dual category in SSURGO dataset. They have Hydr | |
Outputs | ||
|
||
NLCD Land Cover Raster | ||
NLCD 2016 Land Cover Dataset | ||
NLCD 2019 Land Cover Dataset | ||
|
||
NLCD Land Cover Vector | ||
NLCD 2016 Land Cover Dataset Vectorized | ||
NLCD 2019 Land Cover Dataset Vectorized | ||
|
||
NLCD Impervious Surface Raster | ||
NLCD 2016 Impervious Surface Dataset | ||
NLCD 2019 Impervious Surface Dataset | ||
|
||
Soil Layer | ||
SSURGO Extended Soil Dataset | ||
|
@@ -35,6 +35,6 @@ Generated Curve Number Layer based on Land Cover and HSG values. | |
|
||
Algorithm author: Abdul Raheem Siddiqui | ||
Help author: Abdul Raheem Siddiqui | ||
Algorithm version: 1.2 | ||
Algorithm version: 1.3 | ||
Contact email: [email protected] | ||
Disclaimer: The curve number generated with this algorithm is a high level estimate and should not be used for detailed modeling or construction projects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
from qgis.PyQt.QtGui import QIcon | ||
from qgis.PyQt.QtCore import QCoreApplication, QVariant | ||
from qgis.core import ( | ||
QgsApplication, | ||
QgsProcessing, | ||
QgsProcessingAlgorithm, | ||
QgsProcessingParameterFeatureSource, | ||
|
@@ -54,6 +55,8 @@ | |
|
||
cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0] | ||
sys.path.append(cmd_folder) | ||
qgis_settings_path = QgsApplication.qgisSettingsDirPath().replace("\\", "/") | ||
cn_log_path = os.path.join(qgis_settings_path, "curve_number_generator.log") | ||
|
||
from cust_functions import ( | ||
check_crs_acceptable, | ||
|
@@ -62,14 +65,14 @@ | |
) | ||
|
||
__author__ = "Abdul Raheem Siddiqui" | ||
__date__ = "2021-06-19" | ||
__date__ = "2021-08-04" | ||
__copyright__ = "(C) 2021 by Abdul Raheem Siddiqui" | ||
|
||
# This will get replaced with a git SHA1 when you do a git archive | ||
|
||
__revision__ = "$Format:%H$" | ||
|
||
curr_version = "1.2" | ||
curr_version = "1.3" | ||
|
||
|
||
class CurveNumberGeneratorAlgorithm(QgsProcessingAlgorithm): | ||
|
@@ -141,13 +144,24 @@ def initAlgorithm(self, config=None): | |
) | ||
) | ||
|
||
# read usage | ||
with open(os.path.join(cmd_folder, "usage_counter.log"), "r+") as f: | ||
counter = int(f.readline()) | ||
# read usage to add HTML Output option | ||
|
||
# check if counter is milestone | ||
if (counter + 1) % 25 == 0: | ||
self.addOutput(QgsProcessingOutputHtml("Message", "Curve Number Generator")) | ||
try: # try-except because trivial feature | ||
if os.path.exists(cn_log_path): | ||
with open(cn_log_path, "r+") as f: | ||
counter = int(f.readline()) | ||
|
||
# check if counter is milestone | ||
if (counter + 1) % 25 == 0: | ||
self.addOutput( | ||
QgsProcessingOutputHtml("Message", "Curve Number Generator") | ||
) | ||
|
||
else: # for the first time create file | ||
with open(cn_log_path, "w") as f: | ||
f.write(str(0)) | ||
except: | ||
pass | ||
|
||
# check if new version is available of the plugin | ||
try: # try except because this is not a critical part | ||
|
@@ -252,11 +266,11 @@ def processAlgorithm(self, parameters, context, model_feedback): | |
|
||
# NLCD Impervious Raster | ||
if nlcd_rast_imp_output == True: | ||
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)}&" | ||
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)}&" | ||
|
||
# Download NLCD Impervious Raster | ||
try: | ||
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2016_Impervious_L48/ows" | ||
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Impervious_L48/ows" | ||
r = requests.head(ping_URL, verify=False) | ||
r.raise_for_status() | ||
|
||
|
@@ -341,11 +355,11 @@ def processAlgorithm(self, parameters, context, model_feedback): | |
or nlcd_vect_output == True | ||
or nlcd_rast_output == True | ||
): | ||
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)}&" | ||
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)}&" | ||
|
||
# Download NLCD | ||
try: | ||
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2016_Land_Cover_L48/ows" | ||
ping_URL = "https://www.mrlc.gov/geoserver/mrlc_display/NLCD_2019_Land_Cover_L48/ows" | ||
r = requests.head(ping_URL, verify=False) | ||
r.raise_for_status() | ||
|
||
|
@@ -1029,7 +1043,7 @@ def processAlgorithm(self, parameters, context, model_feedback): | |
) | ||
|
||
# log usage | ||
with open(os.path.join(cmd_folder, "usage_counter.log"), "r+") as f: | ||
with open(cn_log_path, "r+") as f: | ||
counter = int(f.readline()) | ||
f.seek(0) | ||
f.write(str(counter + 1)) | ||
|
@@ -1085,7 +1099,8 @@ def icon(self): | |
return icon | ||
|
||
def shortHelpString(self): | ||
return """<html><body><h2>Algorithm description</h2> | ||
return """<html><body><a "href"="https://github.com/ar-siddiqui/curve_number_generator/wiki/Tutorials">Video Tutorials</a></h3> | ||
<h2>Algorithm description</h2> | ||
<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> | ||
<h2>Input parameters</h2> | ||
<h3>Area Boundary</h3> | ||
|
@@ -1100,16 +1115,16 @@ def shortHelpString(self): | |
If checked the algorithm will assume HSG A/B/C for each dual category soil.</p> | ||
<h2>Outputs</h2> | ||
<h3>NLCD Land Cover Vector</h3> | ||
<p>NLCD 2016 Land Cover Dataset Vectorized</p> | ||
<p>NLCD 2019 Land Cover Dataset Vectorized</p> | ||
<h3>NLCD Land Cover Raster</h3> | ||
<p>NLCD 2016 Land Cover Dataset</p> | ||
<p>NLCD 2019 Land Cover Dataset</p> | ||
<h3>NLCD Impervious Surface Raster</h3> | ||
<p>NLCD 2016 Impervious Surface Dataset</p> | ||
<p>NLCD 2019 Impervious Surface Dataset</p> | ||
<h3>Soil Layer</h3> | ||
<p>SSURGO Extended Soil Dataset </p> | ||
<h3>Curve Number Layer</h3> | ||
<p>Generated Curve Number Layer based on Land Cover and HSG values.</p> | ||
<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: [email protected]</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>""" | ||
<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: [email protected]</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>""" | ||
|
||
def helpUrl(self): | ||
return "mailto:[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
name=Curve Number Generator | ||
qgisMinimumVersion=3.6 | ||
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. | ||
version=1.2 | ||
version=1.3 | ||
author=Abdul Raheem Siddiqui | ||
[email protected] | ||
|
||
|
@@ -21,10 +21,9 @@ repository=https://github.com/ar-siddiqui/curve_number_generator | |
|
||
hasProcessingProvider=yes | ||
# Uncomment the following line and add your changelog: | ||
changelog= Version 1.2 - 2021-06-19 | ||
- Return layers in CRS of input layer | ||
- Check for the availability of the latest version of the plugin | ||
- Fix error in default CN lookup table | ||
changelog= Version 1.3 - 2021-08-04 | ||
- Change NLCD LU to 2019 | ||
- Change NLCD Impervious Raster to 2019 | ||
|
||
|
||
# Tags are comma separated with spaces allowed | ||
|
Oops, something went wrong.