This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
class Toolbox(object): | |
def __init__(self): | |
self.label = u'Example_Toolbox' | |
self.alias = '' | |
self.tools = [FirstTool, SecondTool, ThirdTool] | |
class FirstTool(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
import os | |
def create_path(path): | |
if not os.path.exists(path): | |
print "Creating directory {}".format(path) | |
os.makedirs(path) | |
# default application data dir; e.g. c:\Users\scw\AppData\Roaming |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
arcpy.CheckOutExtension("spatial") | |
raster = arcpy.Raster("c:\\workspace\\input_raster") | |
range = raster.maximum - raster.minimum | |
bins = 256 | |
bin_size = (range) / bins | |
# now we know the bin width, can multiply that by the OBJECTID for the lower bound of each | |
lower_bin_value = [bin_size * i for i in range(bins)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pulled from http://resources.arcgis.com/en/help/main/10.1/00qn/pdf/ArcGIS10_Acknowledgements.pdf | |
7-Zip 9.2 | |
ASP.NET AJAX Control Toolkit 1.0.10920.0 | |
ASP.NET AJAX JavaScript library 1.0 | |
ASP.NET MVC 2 | |
Alphaworks ICU 2.2 | |
Ant 1.6.5 | |
Apache log4cxx | |
Apache AXIS 1.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def updateParameters(self, parameters): | |
validator = getattr(self, 'ToolValidator', None) | |
# parameter names | |
cols = ['bathy', 'inner', 'outer', 'scale_factor', 'output'] | |
outer_radius = parameters[cols.index('outer')].valueAsText | |
bathy = parameters[cols.index('bathy')].valueAsText | |
if outer_radius is not None and bathy is not None: | |
raster_desc = arcpy.Describe(bathy) | |
# get the cellsize of the input raster; assume same in X & Y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Anderson: | |
http://gis.stackexchange.com/users/5330/awesomo | |
Chico: | |
http://gis.stackexchange.com/users/2749/boyle300 | |
Nevada City: | |
http://gis.stackexchange.com/users/357/brianpeasley | |
Sacramento: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fine scale inner block | |
outFocalStatistics = FocalStatistics(Bathy, NbrAnnulus(FineInnerRadius, FineOuterRadius, "CELL"), "MEAN") | |
outRaster = Int(Plus(Minus(Bathy, outFocalStatistics), 0.5)) | |
# broad scale inner block | |
outFocalStatistics = FocalStatistics(Bathy, NbrAnnulus(BroadInnerRadius, BroadOuterRadius, "CELL"), "MEAN") | |
outRaster = Int(Plus(Minus(Bathy, outFocalStatistics), 0.5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# distance_from_shore.py: compute true distance between points | |
# and closest geometry. | |
# shaun walbridge, 2012.05.15 | |
# TODO: no indexing used currently, could stand if performance needs | |
# improving (currently runs in ~1.5hr for 13k points) | |
from geopy import distance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgdal) | |
behrmann.crs <- CRS('+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +ellps=WGS84 +units=m +no_defs') | |
# define a known point in Behrmann projection | |
point <- SpatialPoints(cbind(0, 7284713.234), behrmann.crs) | |
# try reprojecting point back to WGS84 | |
spTransform(point, CRS('+init=epsg:4326')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkRaster <- function(raster) { | |
if (raster@nrows * raster@ncols == 220106) { | |
message <- paste("Raster size checks out for layer:", raster@layernames, sep="") | |
} | |
else { | |
message <- paste( "invalid raster dimensions; nrows:", raster@nrows, " ncols:", raster@ncols, sep="") | |
} | |
print(message) | |
} |