POST
|
Downloaded the LocalGovernment.xml thanks to the above post, but still get this error message even though I have Excel installed: [ATTACH=CONFIG]34764[/ATTACH]
... View more
06-20-2014
05:10 AM
|
0
|
0
|
389
|
POST
|
I'm experiencing a similar issue, extensions turned on, point threshold not exceeded, but all profile tools are greyed out. [ATTACH=CONFIG]32113[/ATTACH] ***new*** I can now see the selected profile in the 3D viewer, but still not with the Profile Tool
... View more
03-11-2014
08:04 AM
|
0
|
0
|
980
|
POST
|
I have 27 .nc files and want to extract the precipitation "prcp" values above 25mm and write them along with their x,y coordinates to a .csv file for further analysis in ArcGIS. I have 10.1 installed as well as Python 2.7 with numpy and scipy modules. Any ideas on why this code isn't working? Error: Traceback (most recent call last): File "E:\UGA\COWEETA\Daymet\netcdf2csv.py", line 69, in <module> lat = var.getValue() File "C:\Python27\ArcGIS10.1\lib\site-packages\scipy\io\netcdf.py", line 784, in getValue return self.data.item() ValueError: can only convert an array of size 1 to a Python scalar import sys
import os
import csv
import numpy
import scipy.io
from scipy.io import netcdf
path_netcdf='C:\\PRCP11028\\'
THRESHOLD = 25
x_dimension = "x"
y_dimension = "y"
band_dimension = ""
dimension = "time"
dimension_values = ""
valueSelectionMethod = "BY_VALUE"
extension = ".nc"
files=os.listdir(path_netcdf)
fcsv = open(path_netcdf+"extremes.txt","wb")
csvFile = csv.writer(fcsv)
for fname in files:
if fname.lower().endswith(extension):
print fname
variable, extension = fname.split(".")
netcdfFile = netcdf.netcdf_file(os.path.join(path_netcdf,fname), 'r')
allDimNames = netcdfFile.dimensions.keys()
for dimName in allDimNames:
dimValue = netcdfFile.dimensions[dimName]
## print dimName, ' : ', dimValue
tileID = getattr(netcdfFile, 'tileid')
strTile = str(tileID)
#print tileID
year = getattr(netcdfFile, 'start_year')
strYear = str(year)
#print strYear
variableNames = netcdfFile.variables.keys()
#print variableNames
var = netcdfFile.variables["lat"]
#print var
lat = var.getValue()
#print lat
var = netcdfFile.variables["lon"]
lon = var.getValue()
## print lon
var = netcdfFile.variables["x"]
x = var.getValue()
## print x
var = netcdfFile.variables["y"]
y = var.getValue()
## print y
var = netcdfFile.variables["prcp"]
prcp = var.getValue()
## myshape = var.shape
## print myshape
for day in range(0,364):
strDay = str(day+1)
aboveThresIndices = prcp[day] >= THRESHOLD
lats = lat[aboveThresIndices]
lons = lon[aboveThresIndices]
prcps = prcp[day][aboveThresIndices]
for iLat in range(0,len(lats)):
## print lats[iLat], " ", lons[iLat]
csvFile.writerow([tileID,strDay,lats[iLat],lons[iLat],prcps[iLat]])
netcdfFile.close()
fcsv.close()
print "-------- finished"
sys.exit()
... View more
09-24-2012
01:35 PM
|
0
|
1
|
7290
|
POST
|
I am having the same problem as Sarah. Every method I have attempted results in an output raster with values of all zeroes. I think this has something to do with the 1 bit depth of the binary input rasters. Anyone have any ideas? I've been working on this for several weeks with no success!
... View more
09-19-2012
07:06 AM
|
1
|
0
|
143
|
POST
|
I have >9000 binary rasters that I've created. I want to add them all together to arrive at a frequency of events for each cell. I've tried using Model Builder and the Iterator to run Cell Statistics. I've also tried Greater Than Frequency. The process completes without error, but each time the result is a raster with all 0 values (not NoData). I've tinkered around with some Python scripts as well to no avail. Anyone have any ideas? I am suspicious of the 1 bit data in the original rasters as the culprit.
... View more
09-11-2012
06:07 AM
|
0
|
2
|
3625
|
POST
|
How large are your netCDF files? Unless they are extremely resolved spatially, I doubt it's a memory problem. If you don't find anything there, pin down what line is throwing the error. Are any output files being produced and, if so, are they correct? Phil, Each file is around 75MB. Output files are being produced and they are correct (.img rasters). The reason we think it's a memory problem is that the process dies each time at a different file. The initial code included the creation of .lyr files as well. Once we deleted that process, it ran longer before terminating. Our goal is to extract the days with precip >= 25 mm from 1982 to 2008 for 9 different spatial tiles (from Daymet data source). I have 243 .nc files that have to be queried and I was trying to get the rasters created so that I could do something in Model Builder to query them. If you think a NetCDF module would work best for this and can point me in the direction of one that could be used by someone with limited Python experience, I would appreciate it!
... View more
07-13-2012
10:32 AM
|
0
|
0
|
387
|
POST
|
I am processing 9 tiles (.nc files) with 27 years of records each. This modified script runs fine for a while and then gives a Failure to Execute. I assume that the arcpy cache is reaching a limit of some sort. I have searched the forums and most point me to numpy or netcdf4 modules that I can't understand. Can someone tell me a simpler way to modify this code to address the problem? #Convert NetCDF files to Imagine img files #Jason Geck jgeck@alaskapacific.edu #Make a separate raster *.img file for each dimension value (time) in a netcdf file # 2012.07.03 Modified by Sergio Bernardes/Chris Strother import arcpy, os, time, datetime, calendar # Set local variables arcpy.env.overwriteOutput = True arcpy.env.scratchWorkspace = "C:\\Scratch\\" path = "C:\\PRCP\\" path_rasters = "C:\\PRCPRasters\\" extension = ".nc" dirList=os.listdir(path) #Loops thru all days of year (including leap days) #Year info Yr = range (1982,2008) #Month info allmnths = range(1,13) for fname in dirList: if fname.lower().endswith(extension): tile, Yr, datatype = fname.split("_") intYr = int(Yr) #print tile, yr, datatype for mnths in allmnths: Lastday = calendar.monthrange(intYr, mnths)[1] MRange = range(1,Lastday+1) for dyy in MRange: dyys =int(dyy) mnthsss = int(mnths) yrs = int(Yr) stringMonth = str(mnthsss) stringDays = str(dyys) a = stringMonth.zfill(2) + "/" + stringDays.zfill(3)+"/"+Yr b = stringMonth.zfill(2) + "_" + stringDays.zfill(3) +"_"+Yr print a,b inDate = "time " + a prcp_nc = path + fname prcp_Layer = "prcp_Layer" + b test_img = path_rasters + tile + "_" + b + ".img" # Process: Make NetCDF Raster Layer arcpy.MakeNetCDFRasterLayer_md(prcp_nc, "prcp", "x", "y", prcp_Layer, "", inDate, "BY_VALUE") print "Created NetCDF Layer for " + prcp_Layer # Process: Copy Raster arcpy.CopyRaster_management(prcp_Layer, test_img, "", "", "", "NONE", "NONE", "") print "Created Raster for " + prcp_Layer print "------------- finished"
... View more
07-11-2012
07:56 AM
|
0
|
3
|
616
|
POST
|
I need to use a file iterator to make raster layers from a folder containing 244 .nc files of daily precipitation data. The Make Raster Layer from NetCDF tool will not recognize the File.nc input. I am not a strong enough Python programmer to figure this out without numpy or scipy (which I can't get to load on my Win 7 64-bit machine). Any ideas?
... View more
06-26-2012
11:53 AM
|
0
|
0
|
336
|
POST
|
Jake, Thanks for all of your time helping me with this. This will enable me to get over a "hump" that I've been stuck on for two weeks. Chris
... View more
11-17-2011
09:29 AM
|
0
|
1
|
822
|
POST
|
Jake, Yes, for example, one is called 123.tif and the other is 123.img.
... View more
11-17-2011
02:43 AM
|
0
|
0
|
822
|
POST
|
Thanks for your help. I wasn't very clear, I'm trying to subtract 724 pairs of rasters. I'm creating normalized Digital Surface Models (nDSMs) from 724 DSMs and 724 DEMs. Chris
... View more
11-16-2011
02:23 PM
|
0
|
0
|
822
|
POST
|
I'm creating a workflow and need to perform an iteration of the Minus Tool. Unfortunately, only one iterator is allowed in a model and I can't tell the tool to get a file from one folder and subtract it from another file from a different folder (724 times). Someone suggested the batch function of the tool, but that requires me to click each file to add it to the list to process. Any work arounds or suggestions?
... View more
11-15-2011
10:16 AM
|
0
|
8
|
3721
|
POST
|
I have created two rasters with the identical cell size, rows, columns. When subtracting B from A, I am getting a negative value even though the Min value of A is larger than that of B. Any ideas?
... View more
10-03-2011
09:39 AM
|
0
|
2
|
658
|
Title | Kudos | Posted |
---|---|---|
1 | 09-19-2012 07:06 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|