I need to Mean for multiple rasters in a folder with their corresponding rasters in another folder

436
8
11-21-2019 02:59 AM
ravitejaSETTIPALLI
New Contributor II

I am attempting to iterate through and Mean two sets of corresponding rasters(each set conatains 136 files), named 'AQUA' (e.g. 'MOD04_3K.A2019060.mosaic.061.2019318071023.pssgmc_000501390776.Optical_Depth_Land_And_Ocean-Optical_Depth_Land_And_Ocean.tif') and 'TERRA' (e.g.'MYD04_3K.A2019060.mosaic.061.2019318064730.pssgmc_000501390767.Optical_Depth_Land_And_Ocean-Optical_Depth_Land_And_Ocean.tif'),but iam facing this Runtime error
Runtime error
Traceback (most recent call last):
File "<string>", line 7, in <module>
RuntimeError: ERROR 000732: Input Raster: Dataset D:\FINAL\TERRA\MYD04_3K.A2019060.mosaic.061.2019318064730.pssgmc_000501390767.Optical_Depth_Land_And_Ocean-Optical_Depth_Land_And_Ocean.tif.tif does not exist or is not supported

Lochlan Jones ‌@Dan Patterson 

0 Kudos
8 Replies
DanPatterson_Retired
MVP Esteemed Contributor

could be the double *.tif.tif at the end of the filename

ravitejaSETTIPALLI
New Contributor II

not working sir,please look into issue sir

0 Kudos
ravitejaSETTIPALLI
New Contributor II

0 Kudos
ravitejaSETTIPALLI
New Contributor II

0 Kudos
ravitejaSETTIPALLI
New Contributor II

sir could you trouble shoot my process,i attached the file and i have to

calculate mean for those corresponding data sets.

0 Kudos
LaurenDreyfuss
Esri Contributor

Hi Raviteja,

Does shortening the file names allow the code to work? Also, does removing the periods (".") in the file names help? 

-Lauren

0 Kudos
ravitejaSETTIPALLI
New Contributor II

i tried as you said,but still facing same issueruntime error :

Runtime error
Traceback (most recent call last):
File "<string>", line 9, in <module>
RuntimeError: ERROR 000732: Input Raster: Dataset D:\final 2\TERRA\MYD04_3K.A2019060_terra.tif does not exist or is not supported

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Your file names and paths need some work since they will continue to generate errors unless you raw encode them or use forward slashes

# ---- big fail
f = "D:\final 2\TERRA\Some.File.With.Periods.tif"
f
'D:\x0cinal 2\\TERRA\\Some.File.With.Periods.tif'  # ---- unicode fail


# ---- raw encoding with the little `r` works for sure
f = r"D:\final 2\TERRA\Some.File.With.Periods.tif"
f
'D:\\final 2\\TERRA\\Some.File.With.Periods.tif'

# ---- this works by chance because little f isn't the same as big F
f = "D:\Final 2\TERRA\Some.File.With.Periods.tif"
f
'D:\\Final 2\\TERRA\\Some.File.With.Periods.tif'
0 Kudos