Пример #1
0
 def testfrequency(self):
     est = ap.frequency([1,1,2,3,4,4,4])
     obs = {1: 2, 2: 1, 3: 1, 4: 3}
     samekeys = set(est.keys()) == set(obs.keys())
     good = all([samekeys] + [est[i] == obs[i] for i in est])
     self.assertTrue(good)
     pass
Пример #2
0
 def testfrequency(self):
     est = ap.frequency([1,1,2,3,4,4,4])
     obs = {1: 2, 2: 1, 3: 1, 4: 3}
     samekeys = set(est.keys()) == set(obs.keys())
     good = all([samekeys] + [est[i] == obs[i] for i in est])
     self.assertTrue(good)
     pass
Пример #3
0
# Make a quick map
# If you are in ArcMap's Python window, add fc as a feature layer.
# This will add the layer if your ArcMap's Geoprocessing options
# allow to 'Add results of geoprocessing operations to the display'.
ap.flyr(fc)
# If you are not in ArcMap, you can still plot the feature class:
ap.chart(fc)


# You can plot values in a column once you read its values into Python.
# Let's first find out what unique landuse categories there are in fc:
ap.distinct(fc, 'landuse')
# How many records of each species are there?
x = ap.values(fc, 'landuse')
ap.frequency(x)

# Now plot zinc concentration for landuse 'W'
z = ap.values(fc, 'zinc', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(z)
# Arcapi now plots histograms too!
ap.hist(z)
# Show scatter plot of zinc against distance from the river
# The 'order by' clause ensures values come in the same order
d = ap.values(fc, 'dist_m', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(d, z, main='Zinc', xlab='Ditance', ylab='Zn', pch='o', color='k')


# Suppose we want to add full labels indicating landuse at points.
# This can come as a table, json, or other forms. Anyhow, we would
# convert it to a Python dictionary. I simply re-typed help of 'sp':
Пример #4
0
tmp = ap.summary(fc, ['lime', 'soil', 'ffreq'], ['CAT', 'CAT', 'CAT'])

# Make a quick map
# If you are in ArcMap's Python window, add fc as a feature layer.
# This will add the layer if your ArcMap's Geoprocessing options
# allow to 'Add results of geoprocessing operations to the display'.
ap.flyr(fc)
# If you are not in ArcMap, you can still plot the feature class:
ap.chart(fc)

# You can plot values in a column once you read its values into Python.
# Let's first find out what unique landuse categories there are in fc:
ap.distinct(fc, 'landuse')
# How many records of each species are there?
x = ap.values(fc, 'landuse')
ap.frequency(x)

# Now plot zinc concentration for landuse 'W'
z = ap.values(fc, 'zinc', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(z)
# Show scatter plot of zinc against distance from the river
# The 'order by' clause ensures values come in the same order
d = ap.values(fc, 'dist_m', '"landuse" = \'W\'', '"OBJECTID" ASC')
ap.plot(d, z, main='Zinc', xlab='Ditance', ylab='Zn', pch='o', color='k')

# Suppose we want to add full labels indicating landuse at points.
# This can come as a table, json, or other forms. Anyhow, we would
# convert it to a Python dictionary. I simply re-typed help of 'sp':
# http://cran.r-project.org/web/packages/sp/sp.pdf
landuse2luse = {
    'Aa': 'Agriculture/unspecified',