Browse Source

i.pansharpen: raise fatal error if input data pixels are NULL only

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@56474 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 12 years ago
parent
commit
13a3a50593
1 changed files with 7 additions and 1 deletions
  1. 7 1
      scripts/i.pansharpen/i.pansharpen.py

+ 7 - 1
scripts/i.pansharpen/i.pansharpen.py

@@ -214,6 +214,9 @@ def main():
 
 
         #initial PCA with RGB channels
         #initial PCA with RGB channels
         pca_out = grass.read_command('i.pca', quiet=True, rescale='0,0', input='%s,%s,%s' % (ms1, ms2, ms3), output_prefix='tmp%s.pca' % pid)
         pca_out = grass.read_command('i.pca', quiet=True, rescale='0,0', input='%s,%s,%s' % (ms1, ms2, ms3), output_prefix='tmp%s.pca' % pid)
+        if len(pca_out) < 1:
+            grass.fatal(_("Input has no data. Check region settings."))
+
         b1evect = []
         b1evect = []
         b2evect = []
         b2evect = []
         b3evect = []
         b3evect = []
@@ -365,7 +368,10 @@ def matchhist(original, target, matched):
             stats_dict[j] = int(stats_dict[j])
             stats_dict[j] = int(stats_dict[j])
             if j != '*':
             if j != '*':
                 total_cells += stats_dict[j]        
                 total_cells += stats_dict[j]        
-                
+ 
+        if total_cells < 1:
+            grass.fatal(_("Input has no data. Check region settings."))
+
         # Make a 2x256 structured array for each image with a 
         # Make a 2x256 structured array for each image with a 
         #   cumulative distribution function (CDF) for each grey value.
         #   cumulative distribution function (CDF) for each grey value.
         #   Grey value is the integer (i4) and cdf is float (f4).
         #   Grey value is the integer (i4) and cdf is float (f4).