|
POST
|
Dan Patterson. I exactly followed the same which one you posted. after all this process also indentation issue coming. Below i have a attached snapshot
... View more
08-30-2016
05:16 AM
|
0
|
4
|
1288
|
|
POST
|
Dan Patterson. Thank you for the suggestions.. Regarding indentation issues with my posted code i don't know why indentation occurring even i posted code very carefully with syntax highlighting.
... View more
08-30-2016
04:59 AM
|
0
|
6
|
1288
|
|
POST
|
Xander Bakker Dan Patterson. Several researcher has been tested the issue of How effectively different interpolation techniques can predict the missing value based on known value, they found Kriging is working effectively to predict the missing value. And its very close to the observation. Thank you.
... View more
08-30-2016
04:20 AM
|
0
|
8
|
1288
|
|
POST
|
Earlier i had post the issues of taking multiple Z value to perfrom IDW. From IDW interpolation its seems to be not much accurate. I am trying to execute Universal Kriging (LINEARDRIFT). I have written one code to perform kriging, but its not running, And i am confused to select some variable for Kriging. Below i have attached point shape file, which i am performing Kriging. Error massage from below code while performing Kriging Message File Name Line Position
Traceback
<module> D:\Arc-GIS-Python-Script\KRIGING_PAR1.py 31
Kriging C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py 2405
swapper C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Utils.py 47
wrapper C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py 2397
<lambda> C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py 484
RuntimeError: Object: Error in executing tool Below is the code import arcpy
from arcpy import env
from arcpy.sa import *
arcpy.env.parallelProcessingFactor = "100%"
arcpy.env.overwriteOutput = True
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
env.workspace = r"D:\SWAT-WEATHER-DATA"
# Set local variables
inPointFeatures = r"D:\SWAT-WEATHER-DATA\SELECTED-EX-MERGE.shp"
zFields = ["Max_Temper", "Min_Temper", "Precipitat", "Wind", "Relative_H", "Solar"]
#Kriging Veriable
cellSize = 0.002298707671
lagSize = 0.5780481172534
majorRange = 6
partialSill = 3.304292110
nugget = 0.002701348
kRadius = RadiusFixed(20000, 1)
#Mask region of interest
mask="D:\Gujarta Shape file\GUJARATSTATE.shp"
# Execute Kriging
for zField in zFields:
kModelUniversalObj = KrigingModelUniversal("LINEARDRIFT", lagSize, majorRange, partialSill, nugget)
OutKriging = Kriging(inPointFeatures, zField, kModelUniversalObj, kRadius)
# Execute Mask
#IDWMASk = ExtractByMask(outIDW, mask)
IDWKrig = ExtractByMask(OutKriging, mask)
if not zField == "Solar":
# Save output, except Solar Radiation raster
IDWKrig.save("012_{}.tif".format(zField))
else:
#Only for Solar Radiation raster
PAR = (IDWKrig * 30) * 0.5
#Save output, Only for Solar Radiation raster
PAR.save("012_{}.tif".format(zField))
#print done
print 'done'
... View more
08-30-2016
03:44 AM
|
0
|
13
|
1739
|
|
POST
|
Xander Bakker. Thank you very much. Code working perfectly. Regarding indentation issue with my code , i had chosen Python syntax but i don't know why still indentation issue exist. I am sorry for the inconvenience caused. Hope next time that issue will not be persist. I will follow the step suggested by you. Once again thank you.
... View more
08-29-2016
07:13 AM
|
0
|
1
|
1191
|
|
POST
|
Xander Bakker. I am trying to bit modify the above code, I am trying to multiplication month wise value with FPAR raster (line no 36), but code generating only December month's output from both calculation. (Line no 27 and 36) I have made one code, take reference from earlier code , Below is my working code . Problem with the code is, this code generating only December month's output (r012_FPAR, r012_APAR, ). rest of month its not generating any output. I have tried to find out the solution, but i could not able to find out. def main():
import arcpy
import os
from arcpy.sa import *
arcpy.env.overwriteOutput = True
# Checkout extension
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True
# avoid using - in folders in combination with raster calculations!
ws_in_mean = r'D:\MODIS-NDVI-2012\MASKED-NDVI-2012A'
ws_out_fpar = r'D:\MODIS-NDVI-2012\FPARC'
ws_out_apar = r'D:\MODIS-NDVI-2012\APARC'
# dictionary with values per month
dct = {'001': 17,'002': 19, '003': 23, '004': 28,
'005': 31,'006': 27, '007': 22, '008': 18,
'009': 16,'010': 21, '011': 17, '012': 18}
# list "mean" rasters
arcpy.env.workspace = ws_in_mean
lst_ras_mean = arcpy.ListRasters()
print "lst_ras_mean", lst_ras_mean
for ras_name in lst_ras_mean:
ras_mean = arcpy.Raster(os.path.join(ws_in_mean, ras_name))
print "ras_mean", ras_name
# calculate ((Raster * Min Rater value) * (0.95 * 0.01)) / (Max raster value * Min Raster Value ) + 0.01
ras_fpar = (((ras_mean - ras_mean.minimum) * (0.95 - 0.01)) / (ras_mean.maximum - ras_mean.minimum)) + 0.01
# save raster
ras_num = ras_name[:3]
out_name_fpar = os.path.join(ws_out_fpar, 'r{0}_FPAR.TIF'.format(ras_num))
ras_fpar.save(out_name_fpar)
#Calculate APAR
month_value = dct[ras_num]
ras_apar = ras_fpar * month_value
# save APAR raster
out_name_apar = os.path.join(ws_out_apar, 'r{0}_APAR.TIF'.format(ras_num))
ras_apar.save(out_name_apar)
if __name__ == '__main__':
main()
... View more
08-28-2016
10:42 PM
|
0
|
3
|
1191
|
|
POST
|
Dan_Patterson. Thank you very much. I have done it.
... View more
08-27-2016
11:58 AM
|
0
|
0
|
1347
|
|
POST
|
I have selected the value which fall under 10 by select by attribute . After selection how i can i replace my desire vale of 15, into all row ?
... View more
08-27-2016
11:56 AM
|
0
|
0
|
1347
|
|
POST
|
Dan_Patterson There are total more than 15000 row, so by manually typing its very taking process to check each row . Therefore i want to apply condition statement through filed calculator
... View more
08-27-2016
11:42 AM
|
0
|
3
|
1347
|
|
POST
|
I am trying to change the Solar field (Alphabatic position is i of this field) value. In Solar field whichever value below 10 , i am trying to replace it by 15. So i am trying it using Arc GIS filed calculator. but i could not process it. I have attached below the images of my field value range and type. Please suggest me to this task.
... View more
08-27-2016
10:54 AM
|
0
|
5
|
2560
|
|
POST
|
Xander Bakker. Thank you very much. I changed the line. Now code working perfectly. I am grateful to you for your help.
... View more
08-26-2016
09:39 AM
|
0
|
0
|
1067
|
|
POST
|
xander_bakker Thank you. I ran the code but following error massage i am getting in line no 39 Message File Name Line Position
Traceback
<module> <module1> 65
main <module1> 39
ValueError: The truth value of a raster is ambiguous. Invalid use of raster with Boolean operator or function. Check the use of parentheses where applicable.
... View more
08-26-2016
09:07 AM
|
0
|
6
|
1067
|
|
POST
|
Xander Bakker. I have tried in my best and and corrected the code suggested by you and Dan Patterson. the code is successfully run But i am not getting the desire output from the program, the output name of NPP should be 001_NPP.TIF but i am getting like this rr001_WSCALAR.TIF_NPP.TIF Please cooperation me to solve this issue . Below i attached my updated code def main():
import arcpy
import os
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput = True
# Checkout extension
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True
ws_in_apar = r'D:\MODIS-NDVI-2012\APAR'
ws_in_tscalar = r'D:\MODIS-NDVI-2012\TScalar'
ws_in_wscalar = r'D:\MODIS-NDVI-2012\WScalar'
ws_out_NPP = r'D:\MODIS-NDVI-2012\NPP'
# list "apar" rasters (e.g r001_APAR)
arcpy.env.workspace = ws_in_apar
lst_ras_APAR = arcpy.ListRasters()
print "lst_ras_APAR", lst_ras_APAR
# list "tscalar" rasters (e.g r012_TSCALAR)
arcpy.env.workspace = ws_in_tscalar
lst_ras_TSCALAR = arcpy.ListRasters()
print "lst_ras_TSCALAR", lst_ras_TSCALAR
# list "wscalar" rasters (e.g r001_WSCALAR)
arcpy.env.workspace = ws_in_wscalar
lst_ras_WSCALAR = arcpy.ListRasters()
print "lst_ras_WSCALAR", lst_ras_WSCALAR
for ras_name in lst_ras_APAR:
ras_APAR = arcpy.Raster(os.path.join(ws_in_apar, ras_name))
print "ras_APAR", ras_APAR
for ras_name in lst_ras_TSCALAR:
ras_TSCALAR = arcpy.Raster(os.path.join(ws_in_tscalar, ras_name))
print "ras_TSCALAR", ras_TSCALAR
for ras_name in lst_ras_WSCALAR:
ras_WSCALAR = arcpy.Raster(os.path.join(ws_in_wscalar, ras_name))
print "ras_WSCALAR", ras_WSCALAR
# calculate
ras_NPP = (ras_APAR * ras_TSCALAR * ras_WSCALAR * 0.98)
#Process rectricted within mask file : Process will occur only on location that fall within the mask
#else it will be assigned to nodata inthe output
mask="D:\MOD-REF\NDVI\CROP-L-OCT-15.img"
NPP_Mask = ExtractByMask (ras_NPP, mask)
# save raster
out_name_NPP = os.path.join(ws_out_NPP, 'r{0}_NPP.TIF'.format(ras_name))
NPP_Mask.save(out_name_NPP)
if __name__ == '__main__':
main()
... View more
08-26-2016
08:10 AM
|
0
|
8
|
1251
|
|
POST
|
While i am running the program i am getting the print of raster file (Upto 27 line), when program execute next line then only error occurring, please give suggestion Printing file lst_ras_APAR [u'r001_APAR.TIF', u'r002_APAR.TIF', u'r003_APAR.TIF', u'r004_APAR.TIF', u'r005_APAR.TIF', u'r006_APAR.TIF', u'r007_APAR.TIF', u'r008_APAR.TIF', u'r009_APAR.TIF', u'r010_APAR.TIF', u'r011_APAR.TIF', u'r012_APAR.TIF']
lst_ras_TScalar [u'r001_TSCALAR.TIF', u'r002_TSCALAR.TIF', u'r003_TSCALAR.TIF', u'r004_TSCALAR.TIF', u'r005_TSCALAR.TIF', u'r006_TSCALAR.TIF', u'r007_TSCALAR.TIF', u'r008_TSCALAR.TIF', u'r009_TSCALAR.TIF', u'r010_TSCALAR.TIF', u'r011_TSCALAR.TIF', u'r012_TSCALAR.TIF', u'T_SCALAR_001.tif', u'T_SCALAR_002.tif', u'T_SCALAR_003.tif', u'T_SCALAR_004.tif', u'T_SCALAR_005.tif', u'T_SCALAR_006.tif', u'T_SCALAR_007.tif', u'T_SCALAR_008.tif', u'T_SCALAR_009.tif', u'T_SCALAR_010.tif', u'T_SCALAR_011.tif', u'T_SCALAR_012.tif']
lst_ras_WScalar [u'r001_WSCALAR.TIF', u'r002_WSCALAR.TIF', u'r003_WSCALAR.TIF', u'r004_WSCALAR.TIF', u'r005_WSCALAR.TIF', u'r006_WSCALAR.TIF', u'r007_WSCALAR.TIF', u'r008_WSCALAR.TIF', u'r009_WSCALAR.TIF', u'r010_WSCALAR.TIF', u'r011_WSCALAR.TIF', u'r012_WSCALAR.TIF']
Traceback (most recent call last):
File "<module2>", line 59, in <module>
File "<module2>", line 32, in main
UnboundLocalError: local variable 'ras_apar' referenced before assignment
>>>
... View more
08-26-2016
04:50 AM
|
0
|
0
|
1251
|
|
POST
|
xander_bakker. Thank you. My humble request Can i get a small example of that modification
... View more
08-26-2016
04:28 AM
|
0
|
0
|
1251
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-01-2017 09:56 PM | |
| 1 | 01-19-2017 08:03 AM | |
| 1 | 07-31-2017 11:57 AM | |
| 1 | 08-25-2016 09:38 AM | |
| 1 | 08-17-2016 11:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:25 AM
|