POST
|
import arcpy, os
... from arcpy.sa import*
... arcpy.CheckOutExtension ("Spatial")
... u'CheckedOut'
... arcpy.env.overwriteOutput = True
... arcpy.env.workspace = r'D:\final2\TERRA'
... inws = arcpy.env.workspace
... inws1 = r'D:\final3\AQUA'
... outws = r'D:\final3\OUTPUT'
... rasters = arcpy.ListRasters()
... for r in rasters:
... prefix = os.path.splitext(r)[0]
... suffix = os.path.splitext(r)[1]
... prefix1 = prefix.rstrip("terra")
... raster2 = os.path.join(inws1, prefix1 + "aqua" + suffix)
... print raster2
... outraster = os.path.join(outws, prefix1 + "mean" + suffix)
... print outraster
... outCellStatistics = CellStatistics([arcpy.sa.Raster(r), arcpy.sa.Raster(raster2)], "MEAN")
... outCellStatistics.save(outraster) in previously i used this code to calculate the mean ,now what are the changes i have to make to calculate to calculate mean,could you please look into this.
... View more
11-29-2019
02:57 AM
|
0
|
0
|
608
|
POST
|
thanks sir,finally its working, but thing is now how can i replace the file name MOD by MYD (or) MYD by MOD to calculate mean.
... View more
11-29-2019
02:53 AM
|
0
|
0
|
608
|
POST
|
sir this is my scenario,so that i want to chane/replace the files in terra folder as MOD60_terra, MOD61_terra, ,MOD62_terra...... o and files in aqua folder as MOD60_aqua, MOD61_aqua, MOD62_aqua.......
... View more
11-28-2019
04:43 AM
|
0
|
3
|
608
|
POST
|
but i have 200 files in each folder,so that i cant rename the each file manully,in earlier message you had told that use the replace(),in my script,could you teach me how to use the replace() syntax in my script.
... View more
11-28-2019
03:55 AM
|
0
|
1
|
606
|
POST
|
>>> import arcpy, os
... from arcpy.sa import*
... arcpy.CheckOutExtension ("Spatial")
... u'CheckedOut'
... arcpy.env.overwriteOutput = True
... arcpy.env.workspace = r'D:\final2\TERRA'
... inws = arcpy.env.workspace
... inws1 = r'D:\final2\AQUA'
... outws = r'D:\final2\OUTPUT'
... rasters = arcpy.ListRasters()
... for r in rasters:
... prefix = os.path.splitext(r)[0]
... suffix = os.path.splitext(r)[1]
... prefix1 = prefix.rstrip("terra")
... raster2 = os.path.join(inws1, prefix1 + "aqua" + suffix)
... print raster2
... outraster = os.path.join(outws, prefix1 + "mean" + suffix)
... print outraster
... outCellStatistics = CellStatistics([arcpy.sa.Raster(r), arcpy.sa.Raster(raster2)], "MEAN")
... outCellStatistics.save(outraster)
...
D:\final2\AQUA\MYD60_aqua.tif
D:\final2\OUTPUT\MYD60_mean.tif
D:\final2\AQUA\MYD61_aqua.tif
D:\final2\OUTPUT\MYD61_mean.tif
D:\final2\AQUA\MYD62_aqua.tif
D:\final2\OUTPUT\MYD62_mean.tif thanks alot,it got finally worked.thanks you so much
... View more
11-28-2019
03:51 AM
|
0
|
2
|
606
|
POST
|
>>> import arcpy, os
... from arcpy.sa import*
... arcpy.CheckOutExtension ("Spatial")
... u'CheckedOut'
... arcpy.env.overwriteOutput = True
... arcpy.env.workspace = r'D:\final2\TERRA'
... inws = arcpy.env.workspace
... inws1 = r'D:\final2\AQUA'
... outws = r'D:\final2\output'
... rasters = arcpy.ListRasters()
... for r in rasters:
... prefix = os.path.splitext(r)[0]
... suffix = os.path.splitext(r)[1]
... prefix1 = prefix.rstrip("terra")
... raster2 = os.path.join(inws, prefix1 + "aqua" + suffix)
... print raster2
... outraster = os.path.join(outws, prefix1 + "mean" + suffix)
... print outraster
... outCellStatistics = CellStatistics([arcpy.sa.Raster(r), arcpy.sa.Raster(raster2)], "MEAN", "NODATA")
... outCellStatistics.save(outraster)
...
D:\final2\TERRA\MOD60_aqua.tif
D:\final2\output\MOD60_mean.tif
Runtime error
Traceback (most recent call last):
File "<string>", line 19, in <module>
RuntimeError: ERROR 000732: Input Raster: Dataset D:\final2\TERRA\MOD60_aqua.tif does not exist or is not supported
... View more
11-28-2019
03:12 AM
|
0
|
2
|
606
|
POST
|
Dan Patterson Lochlan Jones shortened my names, but still iam facing same issue
... View more
11-27-2019
01:28 AM
|
0
|
10
|
606
|
POST
|
SIR I TRIED AS YOU SAID,BUT AGAIN IT WAS SHOWING THE BELOW ERROR,PLEASE MAKE A LOOK INTO THAT SIT
... View more
11-25-2019
08:40 PM
|
0
|
13
|
596
|
POST
|
Thanks for reply sir,tomo I will try once again as per your inputs and will post my result .
... View more
11-24-2019
06:48 AM
|
0
|
0
|
596
|
POST
|
This is my exact scenario,if possible please look into that trouble shoot me ,thanks in advance
... View more
11-24-2019
06:22 AM
|
0
|
16
|
596
|
POST
|
11-24-2019
06:19 AM
|
0
|
0
|
596
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|