|
POST
|
Slope in a certain direction is calculated as: S D = S * cos((D - A) * pi /180) Where: [INDENT]S=Slope[/INDENT] [INDENT]D=Direction in degrees to calculate slope for, i.e. 0=North, 90=East, 180=South, 270=East[/INDENT] [INDENT]A=Aspect[/INDENT] I.e. in the Raster Calculator for West (270): [ATTACH=CONFIG]22239[/ATTACH] See the hypothetical surface below with a 30° slope and 180° aspect. Directions to calculate slopes for are indicated by solid arrows: (A) 0°, (B) 180°, (C) 225°, and (D) 90°. Slope in these directions calculated by above equation: (A) -30°, (B) 30°, (C) 21.2°, and (D) 0°. [ATTACH=CONFIG]22240[/ATTACH]
... View more
02-27-2013
02:47 PM
|
0
|
0
|
4533
|
|
POST
|
Works for me in 64 bit python (using the following standalone script) and I have both 32 & 64 bit python installed. import sys,subprocess
if len(sys.argv)>1:
import arcpy
print arcpy
print sys.executable
else:
cmd=['python',__file__,'foo']
proc=subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
exit_code=proc.wait()
stdout,stderr=proc.communicate()
print '\n'.join((str(exit_code),stdout,stderr)) This prints: 0
<module 'arcpy' from 'c:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py'>
C:\Python27\ArcGISx6410.1\python.exe Before running, I have a batch file to set up some environment variables: @echo off
set PYTHONHOME=C:\Python27\ArcGISx6410.1
set PATH=
set PATH=%WINDIR%;%WINDIR%\system32
set PATH=%PYTHONHOME%;%PATH%
A couple of other things to try... 1 - make sure you're not calling subprocess.Popen with shell=True. 2 - try passing a custom "env" to subprocess.Popen with the above env vars, i.e (completely untested...): env=os.environ.copy()
env['PATH']='%s;%s;%s' %
('C:\\Python27\\ArcGISx6410.1',
env['WINDIR'],
env['WINDIR']+'\\system32')
proc=subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,env=env) (curtvprice did some editing to make the code visible again)
... View more
02-27-2013
02:09 PM
|
0
|
0
|
3856
|
|
POST
|
Exactly the same way. Define ROI, run the tool and follow the prompts. NIR is band 4 for Quickbird imagery.
... View more
02-22-2013
11:36 AM
|
0
|
0
|
2976
|
|
POST
|
Tweaked a bit to walk through subfolders. import os,fnmatch,arcpy
def find(pattern, path=os.getcwd()):
for path, dirs, files in os.walk(path):
for filename in files:
if fnmatch.fnmatch(filename, pattern):yield os.path.abspath(os.path.join(path, filename))
for f in find('*.mxd', 'C:/Data'):
mxd = arcpy.mapping.MapDocument(f)
mxd.findAndReplaceWorkspacePaths(r"oldfilepath1", r"newfilepath1")
mxd.findAndReplaceWorkspacePaths(r"oldfilepath2", r"newfilepath2")
mxd.save()
... View more
01-23-2013
06:59 PM
|
1
|
0
|
5034
|
|
POST
|
Field names cannot be longer than 10 characters. No limitation for the file name that I'm aware of.
... View more
11-18-2012
12:32 AM
|
0
|
0
|
3332
|
|
POST
|
There's always more than one way do something 🙂 Here's another import string
fieldValue = "ML-26588-12-a"
stripChars = fieldValue.translate(None, string.digits)
fieldValue = fieldValue.translate(None, stripChars)
print stripChars
print fieldValue prints: ML---a
2658812 And even more 🙂
... View more
11-15-2012
05:31 PM
|
0
|
0
|
7055
|
|
POST
|
I agree with everything Matthew and Chris have said. This is not how you should use a cursor. That said, for future reference... the problem with your original code is you are looping through every row (for row in rows) but then advancing the cursor to the following row (row = rows.next()) without actually processing the current row. When you get to the last row, rows.next() will return None and None types do not have getValue methods which is why your script bombs. for row in rows:
row = rows.next() #<----- This is the problem.
... View more
11-15-2012
04:34 PM
|
0
|
0
|
1852
|
|
POST
|
I didn't bother building in any "pretty display" code. When I run the script on radiance values (standard ENVI Worldview 2 radiance calculation) I get the following displayed: [ATTACH=CONFIG]19135[/ATTACH] But simply stretching the display (enhance menu) the image displays fine: [ATTACH=CONFIG]19136[/ATTACH] Running the script on raw digital numbers (Digitalglobe IMD format, TIFF or ENVI format) I get the image displaying ok (if a little washed out) first time. Not a big deal, I prefer to control the display stretch myself anyway. The band you specified as the NIR band is output as grey as the sampled data (always NIR band) is regressed against each band and when this is done for the NIR band (i.e same values), the slope will always be 1. Note I get better results using band 7 than band 8 for deglinting Worldview2.
... View more
11-07-2012
06:38 PM
|
0
|
0
|
2976
|
|
POST
|
You're trying to run it in ENVI. The script only works in ENVI+IDL.
... View more
11-05-2012
12:41 PM
|
0
|
0
|
2976
|
|
POST
|
Sorry, I don't know. It's only been tested on 4.8/5.0 so it may not run on 4.7 especially since you had issues running the original code on 4.7.
... View more
10-30-2012
10:23 PM
|
0
|
0
|
2976
|
|
POST
|
I've updated this script (see attached) to run from an ENVI menu item. From the readme file: Reference: Hedley, JD, Harborne, AR and Mumby PJ (2005) Simple and robust removal of sun glint for mapping shallow-water benthos International Journal of Remote Sensing 26 (10), pp 2107�??2112. Notes: If you have any land in your image, this method will make it look terrible. As is stated in Hedley et al. (2005): "the algorithm is valid only for submerged pixels". Only run this tool prior to pansharpening as: a. It loads the entire image into memory b. It will take a lot longer... Installation: Copy deglint.sav to the ENVI "save_add" directory: ENVI 4.8: - Windows: C:\Program Files\ITT\IDL\IDL80\products\envi48\save_add\ - OSX: /Applications/itt/idl/idl80/products/envi48/save_add/ - *Nix: /usr/local/itt/idl/idl80/products/envi48/save_add/ ENVI 5.0 (Classic): - Windows: C:\Program Files\Exelis\ENVI50\classic\save_add\ - OSX: /Applications/Exelis/ENVI50/classic/save_add/ - *Nix: /usr/local/Exelis/ENVI50/classic/save_add/ Next time you start ENVI 4.8 or ENVI 5.0 (Classic) there will be a "Deglint" tool in the Spectral menu. Usage: Start ENVI 4.8 or Envi Classic 5.0, open and display the image you want to deglint. Start the ROI tool and define an ROI containing a number of samples of areas of deep water. Select the "Spectral"->"Deglint" menu option and follow the prompts.
... View more
10-29-2012
05:03 PM
|
0
|
0
|
2181
|
|
POST
|
Have you checked that the values are actually different? They're likely just visually different when viewed in ArcMap as the clip tool would have calculated statistics and then the output raster will get displayed with a 2 standard deviation stretch by default. Double click the clipped raster in your ArcMap TOC, select Symbology tab and set stretch to None, then do the same for the input raster and they should then look the same.
... View more
10-21-2012
09:28 PM
|
0
|
0
|
703
|
|
POST
|
Those instructions and the version of GDAL they link to are very old. The GDAL project no longer provides windows binaries (link). You can install GDAL from gisinternals.com. Download gdal-19-1500-core.msi and GDAL-1.9.1.win32-py2.X.exe (replace 2.X with 2.7 if you have ArcGIS 10.1 or 2.6 for ArcGIS 10.0).
... View more
10-13-2012
02:14 PM
|
0
|
0
|
4160
|
|
POST
|
Try editing the ascii grid and changing the first value to a floating point value - http://forums.esri.com/Thread.asp?c=93&f=1740&t=295285
... View more
09-24-2012
03:08 AM
|
0
|
0
|
366
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM | |
| 5 | 04-22-2025 09:04 PM |