|
POST
|
xander_bakker. Thank you for your suggestion. here-with I have tried to give you a glimpse what actually i want to do. i am looking for your kind cooperation. Thank you def main():
import arcpy
import os
arcpy.env.overwriteOutput = True
# Checkout extension
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True
ws_in_mean = r'D:\MODIS-NDVI-2012\MASKED-NDVI-2012A'
ws_out_Vfraction= r'D:\MODIS-NDVI-2012\VEGETATION_Fraction'
ws_out_AET= r'D:\MODIS-NDVI-2012\ACTUAL_ET'
ws_out_Wscalar = r'D:\MODIS-NDVI-2012\W_SCALAR'
# 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 Vfraction sqrt((Raster * Min Rater value)) / (Max raster value - Min Raster Value )
ras_Vfraction = sqrt((ras_mean - ras_mean.minimum) / (ras_mean.maximum - ras_mean.minimum))
ras_Vfraction.save(out_name_Vfraction)
# save raster for Vfraction for different month
ras_num = ras_name[:3]
out_name_Vfraction = os.path.join(ws_out_Vfraction, 'r{0}_Vfraction.TIF'.format(ras_num))
ras_Vfraction.save(out_name_vfraction)
# calculate AET raster(multiplication of monthly dict value with same month Vfraction raster(e.g. 001_Vfraction * 179.36 (value taken from 001_dict))
dct = {'001': 179.36, '002': 194.95, '003': 239.44, '004': 289.05,
'005': 318.66, '006': 272.35, '007': 227.13, '008': 182.76,
'009': 168.53, '010': 210.87, '011': 176.31, '012': 182.41}
# Next multiplication of monthly Vfraction raster with same month dct value (e.g. JANUARY dct :001)
# and store it to ws_out_AET folder name of 001_AET to 012_AET
ras_AET = 001_Vfraction * 179.36 (001_dct)
# After that i want to execute this equation to calculate monthly step WScalar
# And save it to ws_out_Wscalar folder name of e.g for JANUARY: 001_WScalar, For FEBRUARY: 002_WSCALAR .....012_WSCALAR
ras_wscalar = (0.5 + 0.5 * (001_AET / 179.36))(179.36 value taken from 001_dict))
... View more
08-23-2016
08:52 AM
|
0
|
9
|
1168
|
|
POST
|
Xander Bakker. Thank you. I have forget to mentioned one more step, I am extremely sorry for the inconvenience. Here with i am giving clear picture of the code, kind consider it def main():
import arcpy
import os
arcpy.env.overwriteOutput = True
# Checkout extension
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True
ws_in_mean = r'D:\MODIS-NDVI-2012\MASKED-NDVI-2012A'
ws_out_Vfraction= r'D:\MODIS-NDVI-2012\VEGETATION_Fraction'
ws_out_AET= r'D:\MODIS-NDVI-2012\ACTUAL_ET'
ws_out_Wscalar = r'D:\MODIS-NDVI-2012\W_SCALAR'
# 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 )
ras_Vfraction = sqrt((ras_mean - ras_mean.minimum) / (ras_mean.maximum - ras_mean.minimum))
ras_Vfraction.save(out_name_Vfraction)
# save raster
ras_num = ras_name[:3]
out_name_fpar = os.path.join(ws_out_fpar, 'r{0}_Vfraction.TIF'.format(ras_num))
ras_fpar.save(out_name_vfraction)
# calculate Wscalar raster
dct = {'001': 179.36, '002': 194.95, '003': 239.44, '004': 289.05,
'005': 318.66, '006': 272.35, '007': 227.13, '008': 182.76,
'009': 168.53, '010': 210.87, '011': 176.31, '012': 182.41}
# Next multiplication of monthly Vfraction raster with monthwise dct value
# and store it to ws_out_AET folder name of 001_AET to 012_AET
ras_AET = 001_Vfraction * 179.36 (001)
# After that i want to execute this equation to calculate monthly step WScalar
# And save it to ws_out_Wscalar folder name of 001_WScalar
ras_wscalar = 0.5 + 0.5 * 001_AET / 001_dct Value (179.36)
... View more
08-23-2016
07:16 AM
|
0
|
11
|
1656
|
|
POST
|
Xander Bakker. I would like to do small modification on above code. Instead of Multiplication sr raster with FPAR (Line no 43). I want to multiply some specific value with monthly FPAR raster. And keep as it same. JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER 179.36 194.95 239.44 289.05 318.66 272.35 227.13 182.76 168.53 210.87 176.31 182.41 (Line no 43: ras_apar = ras_sr * ras_fpar) Than i want to execute this equation to calculate one more parameter (e.g for JANUARY : 0.5 + 0.5 * (001_APAR/179.36) , for FEBRUARY: 0.5 + 0.5*(002_APAR/194.95 (For JANUARY)), and save it to workspace (D:\MODIS-NDVI-2012\ws_out_wscaler).
... View more
08-23-2016
02:42 AM
|
0
|
13
|
1656
|
|
POST
|
xander_bakker Dan_Patterson. Thank you for your kind cooperation.
... View more
08-22-2016
08:35 AM
|
0
|
32
|
3357
|
|
POST
|
Xander Bakker. Thank you. the point data comes from model generated output and they provides the datasets in csv format. I don't understand, how to perform (after the aggregation per location with one location per pixel) on those data to calculate Mean value of each location for different parameters. My kind request, please guide me to the task with accurately. Regarding interpolation daily data into a single pixel, Arc GIS has the default setting in Envs Setting: Geo-statistical Analysis : Coincident Points : Mean. So during interpolation i think its calculate the Mean value of different parameter for each location to crate a single pixel from daily data. When i use the Arc GIS IDW tool for performing IDW then its taking some time but when i run the code in pyscripter, its not taking much time to perform interpolation.
... View more
08-22-2016
02:00 AM
|
0
|
34
|
3357
|
|
POST
|
I have 12 point feature datasets for different month. I want to perform IDW interpolation. I have created the python code but its taking only one "Z" field for different month feature datasets from the attribute. Below I have mentioned the code. How to assign here multiple Z field from each month folder (JANUARY, FEBRUARY......DECEMBER). Point feature class from different month folder (e.g. For January Merged_001, for FEBRUARY Merged_002.......for DECEMBER Merged_012 ) and want to perform IDW interpolation and save it as on same month folder as it Z field name (Max_Temper, Min_Temper, Precipitatat, Wind, Relative_H, Solar) with month (e.g for January 001_Max_Temper, 001_Min_Temper, 001_Precipitatat, 001_Wind, 001_Relative_H, 001_Solar). After Whatever Solar raster for different month (for January 001_Solar....for DECEMBER 012_Solar) we will get, I want to do some calculation (001_Solar * 30) *0.5 and save it 001_sr ........012_sr in Month wise folder. Below i have attached Point shapefile also for reference purpose Here is my 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 = "D:\SWAT-WEATHER-DATA2\APRIL"
# Set local variables
inPointFeatures = "D:\SWAT-WEATHER-DATA2\APRIL\Merged_004.shp"
zField = "Min_Temper" #Z_Filed = Max_Temper, Min_Temper, Precipitatat, Wind, Relative_H, Solar
cellSize = 0.002298707671
power = 2
searchRadius = RadiusVariable(10, 150000)
#Mask region of interest
mask="D:\Gujarta Shape file\GUJARATSTATE.shp"
# Execute IDW
outIDW = Idw(inPointFeatures, zField, cellSize, power, searchRadius)
# Execute Mask
IDWMASk = ExtractByMask(outIDW, mask)
# Save output, except Solar Radiation raster
IDWMASk.save("004_Min_Temp.tif")
# 004_Max_Temp.tif, 004_Min_Temp.tif....Solar
#Only for Solar Radiation raster
#PAR = (IDWMASk * 30) * 0.5
#Save output, Only for Solar Radiation raster
#PAR.save("003_sr.tif")
#print done
print 'done'
... View more
08-21-2016
10:29 AM
|
0
|
37
|
11518
|
|
POST
|
Jake Skinner. Above mentioned query i have written the code upto Merging multiple feature for each month Class. Sorry to inconvenience. For next step i have put a new question to this community along with my code. Kindly guide me to do the task. Thank you very much
... View more
08-21-2016
10:22 AM
|
0
|
0
|
1530
|
|
POST
|
Jake Skinner. I have one more query on above program, I would like to add some more step with above program. Step 1: Above program performing well for converting all CSVs to Point shape file. After conversion of each CSVs file to Point shape file, I would like to Merge the different month wise all point shapefile (Belongs to same month) into one datebase and save it in existing months wise different folder. (From this step we will get the month wise single database contain point vector e.g. 001_MERGE, 002_MERGE......012_MERGE) Step: 2 Using those marge points from different month ( got it from Step: 1 e.g. 001_MERGE, 002_MERGE......012_MERGE) want to perform IDW interpolation for selected parameters from Merge point database (e.g. Max_Temper, Min_Temper,Precipitation, Relative humidity, Wind Speed, Solar etc. ) for creating raster map based on defined mask file (Vector File), cell Size (defined raster), Geo-statistical analysis: Coincident Points (Mean), SEARCH RADIUS : (FIXED Distance : 0.118646 ; MINIMUM NO OF POINTS : 2) . output raster map pass it to as on different month folder (Output raster name for January e.g. 001_Max_Temper, 001_Min_Temper, 001_Precipitation, 001_Wind, 001_RH, 001_Radiation: FEBRUARY e.g. 002_Max_Temper, 002_Min_Temper, 002_Precipitation, 002_Wind, 002_RH, 002_Radiation......till December ). Step : 3 Whatever monthly raster only for Solar Radiation (e.g 001_Radiation) we got it from Step 2 , We want perform some calculation, (e.g. 001_Radiation * 30) * 0.5 and save it in different month folder, output name ( e.g 001_sr, 002_sr.....012_sr). Below i have attached the defined mask file and cell size raster.
... View more
08-19-2016
11:36 AM
|
0
|
1
|
1530
|
|
POST
|
Thank you Jake Skinner. Using PyScripter i ran the code throughout the CSVs. Thank you very much for your guidance and cooperation .
... View more
08-19-2016
09:05 AM
|
0
|
2
|
1530
|
|
POST
|
Jake Skinner I have run the code, there is nothing error with this code while i run it on single CSV file but when i run it on 514 CSVs file then Arc GIS suddenly gets shut down (''Arcgis desktop has encountered a serious application error and is unable to continue'') while the time of program execution into 45 number CSVs file. I have total 514 CSVs file. Earlier which CSV file I had sent for reference purpose that is one of my total CSV file. So upto 44 CSVs program run correctly but when program finished 44 number CSVs conversion than automatically Arc GIS gets shut down. I separately run 45 number CSVs file, but I did not find any error with this file. But when I execute 514 CSVs file at same time then after converting 44 CSVs Arc GIS automatically shut down. I am using Arc GIS 10.1, on windows 7 32 bit platform. Below I have attached a video file where i pointed the CSV file of error occurrence and Arc GIS error massage and Kindly find attached CSV file also. I have checked this code on another computers also but there also same issue arising.
... View more
08-19-2016
05:15 AM
|
0
|
4
|
3223
|
|
POST
|
xander_bakker. Thank you. Yes exactly same i was looking for which you mentioned .The modified code is working perfectly. Once again thank you very much for the cooperation.
... View more
08-18-2016
07:38 PM
|
0
|
15
|
1656
|
|
POST
|
Xander Bakker I want to do small modification on above code, following instruction, Instead of multiplication (Line no 43) FPAR * sr raster, i want to do multiplication FPAR * (any numaric value e.g 20) and output raster pass it to APAR folder. meanwhile upto FPAR i want to keep the program same, only APAR stage i want to modify by multiply Numeric digit (any numaric value e.g 20) with FPAR instead of SR raster.
... View more
08-18-2016
11:34 AM
|
0
|
17
|
1656
|
|
POST
|
Thanks Jake Skinner. Code is working perfectly. Once again thank you very much for the cooperation.
... View more
08-18-2016
09:37 AM
|
0
|
0
|
3223
|
|
POST
|
Thank you Dan_Patterson.There was small correction needed, i have solved the issue. Thank you very much
... View more
08-17-2016
10:21 PM
|
0
|
0
|
1656
|
|
POST
|
Xander Bakker. Thank you very much. Finally i have solved the issue. Now the code is running fine without any issues. There was small correction on line 42, Corrected line is, after the rster name sr command did not include. Once again thank you very much. ras_sr = arcpy.Raster(os.path.join(ws_in_sr, ras_name_sr))
... View more
08-17-2016
10:18 PM
|
0
|
18
|
1656
|
| 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
|