Tagged Questions

NumPy is an extension to the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large library of high-level mathematical functions to operate on these arrays.

20 views

How to calculate the raster statistics with polygon layer using numpy and scipy in python?

I have used zonal statistics from processing to calculate the raster statastics with polygon layer. processing.runalg('qgis:zonalstatistics', rlayersource, 1, vlayer, None, True, Path) But this is ...
43 views

Converting large rasters to NumPy

I have a geodatabase that contains a large number of raster datasets - there are two rasters for each country in the world, and they are very large, in some cases up to 3GB per raster dataset. I ...
44 views

Finding the pixel coordinates using GDAL/numpy

Is there a way to get the XY cordinates of a pixel based on the array index using numpy/gdal? I have a new set of extents for a raster and, based on these newer extents, want to determine the ...
31 views

Identify polygons greater than n-th percentile and perform further analyses using arcpy

My goal is to identify tracts that are above the 99 percentile of a variable (xvar), to dissolve contiguous tracts by summing a variable (yvar), and to get the coordinates of the centroids ...
43 views

Segmentation fault while writing an output raster by blocks with rasterio

With the answer on my previous question, I was able to set up reading a raster by blocks. I did some computation and now I try to write the result into another raster. However, the program fails with ...
36 views

QGIS Contour Plugin Says No Shapely; can import shapely in QGIS console

I'm keen to create some contours (isochrones for a pedestrian 'ped-shed' catchment) from a point dataset in QGIS, using the contour plugin from the Plugins repository. I installed the plugin, but ...
35 views

arcpy RasterToNumPyArray causes shift in location of values

I am converting a couple rasters to arrays, then performing calculations on them. First step- polygon to raster. This creates a 1/0 mask that I can multiply the larger raster by. After noticing my ...
25 views

How to accelerate my python looping process for A-star path finding on DEM surface?

I try to make an A-star Path Finding program base on tile-graph (image raster data as graph) where each pixel values represent as cost and elevation.. In my case, DEM raster data was called by using ...
284 views

AttributeError: 'module' object has no attribute 'TabletoNumPyArray'

I am trying to create a Python array using data from an ArcGIS attribute table. Here's the code I've written so far: import arcpy import numpy input = "c:/data/from/arcgis" arr = ...
45 views

Plotting “large” image with points with matplotlib - MemoryError

I want to plot an image of 3193 x 3293 pixels with 1502 points. When running in a smaller image and less points (934,722 pixels and 60 points), everything runs perfectly. I wrote like this: # I am ...
41 views

Downsampling Geotiff using summation - Gdal/Numpy

I am trying to downsample a 1 square km raster dataset to a much larger (.5 degree x .66 degree) dataset by summing all of the pixel values within this large grid cell. gdal_warp does not contain a ...
54 views

ArcPy reading a raster in a moving window?

I typically read large raster data using gdal and setting up a moving window of 256*256 pixels (for example). I recently had to do some processing using arcpy, so I did the same thing, using ...
65 views

Compute annual mean of overlapping cells using daily rasters

I am stuck at somewhat simple looking calculation. I have daily temperature rasters from 2001 to 2014 with following name format: `2001001` `2001002` | | `2014365` I want to compute annual mean ...
92 views

How to place an numpy array into GeoTIFF image using python-gdal

I am attempting to export data of varying scales into GeoTIFF images...a new method for me. The problem I'm running into is when using the GDT_Byte pixel type, data values < 0 and > 256 are not ...
48 views

NumPy Array to Feature Writes only first array object to feature class [closed]

I am consuming a json web-service with NumPy Array to Feature, I have many nested try/except blocks to consume the data/find errors/etc. The script is functional, however I am having trouble seeing ...
79 views

QGIS / Python: Fill new field with values based on other fields and lookup table

I am trying to use Python for QGIS to add values to new fields in an attribute table based on existing fields and values in a lookup table. Attribute table I wish to modify (with example rows): farm ...
47 views

Converting points using FeatureClassToNumPyArray to interpolate cross-section with scipy “interpolate” [closed]

I'm trying to plot elevation cross section and extract elevations along a cross section using scipy's "interpolate" function. I'm converting a point feature class of profile elevation points to 2 ...
91 views

gdal_array.SaveArray() leaves dataset open in Python

When I use gdal_array.SaveArray() to create a raster, the newly created dataset appears to stay open in Python, preventing other processes from working with it. For instance, consider the following ...
166 views

Efficient ways to read table data from a large feature layer?

I have a feature layer that contains about 460,000 records and it currently takes about 20 minutes to read that table using the arcpy.da.TableToNumPyArray() tool. Is there a more efficient way to read ...
47 views

NumPy Array to Feature Class: NameError from Inner Loop Variables

I have a NumPy Array to FC script that parses a JSON web-service. The outer loop writes to my FC correctly, however my inner loop variables come back as not defined when appending the items. The ...
163 views

How does gdal_calc numpy operators work?

Gdal_calc manual Gdal_calc is introduced as : gdal_calc.py - Command line raster calculator with numpy syntax gdal_calc.py [-A <filename>] [--A_band] [-B...-Z filename] [other_options] ...
58 views

Python error in array declaration

I am getting a error as follows File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy__init__.py", line 2292, in NumPyArrayToRaster return _NumPyArrayToRaster(*args, **kwargs) ValueError: ...
174 views

Fixing Raster Calculator Error 000539 ImportError: No module named numpy? [duplicate]

I've created 4 hillshades for a particular area to represent the 4 seasons in a year. The equation I now need to use to determine solar insulation is 1000*hillshade/255 in raster calculator. However, ...
213 views

ArcGIS Raster Calculator error 000539 ImportError: No module named numpy?

I am running ArcGIS 10.2.1 on Win7 64bit. I have finished doing an NDVI, and after defining a vegetation presence threshold at 0.05, opened the Raster Calculator (via Map Algebra in the Arc Toolbox) ...
104 views

Replicating result of gdalwarp using gdal Python bindings

I am trying to re-project/resample with the GDAL python bindings, but am getting slightly different results compared to those from the command line utility gdalwarp. See update below for shorter ...
105 views

Is it possible from the list or np.array, updating the table using arcpy.da.UpdateCursor?

I have created array. Is it possible to update an existing table if the number and order of columns and rows identical? In the array do not have a column headers. for example: array = ...
110 views

Trouble importing NumPy in GRASS. Architecture

I can't get GRASS to work on my system, and after doing some digging I think it is related to me using 64-bit python. I'm not really sure. I get this message... This module requires the ...
24 views

Raster Vector stack

I want clipped image of NDVI for a particular area. I did raster calculation for getting the image with NDVI values. After that I tried extraction function clipper. In this function we have to use two ...
215 views

errors after installing 64 bit background geoprocessing on ArcGIS desktop 10.2.2

I installed 64 bit background geoprocessing on my ArcGIS 10.2.2 and then changed my pythonpath to "C:\Python27\ArcGISx6410.2" so that my code can benefit from the 64bit. then I had to install a 64b ...
402 views

I have raster data in a postgres table that I want to get into python as a numpy array. I am using psycopg2 to connect to the db. I am able to download the data but it comes back as a string (probably ...
2k views

Obtain coordinates and corresponding pixel values from GeoTiff using python gdal and save them as numpy array

How to obtain projected coordinates as well as the actual pixel values at those coordinates from GeoTiff file and then save them into a numpy array? I have arsenci020l.tif file, and its coordinates ...
62 views

Wrong coordinates after Usage of NumPyArrayToRaster(…)

My Project I am currently working at should enable cellvalue manipulation on raster files using ArcPy. My Script works fine except I am not getting the right Y-Values (northing values) for the ...
165 views

Fitting Time-series Values with a Gaussian Function

I'm trying to fit a stack of NDVI values to a Gaussian model to allow for determining dates of certain NDVI values using Python and NumPy/SciPy. I've attempted to do this with ...
72 views

Multiply raster by Numpy derived float value

So I have a python script that uses numpy to calculate the mean of a field, then I try to use that mean value in a raster multiplication as follows: na = ...
147 views

PySAL natural breaks from Numpy array

I am attempting to extract natural break values from a raster using Python. The intended process goes: Arcpy raster object to NumPy Array (using RasterToNumPyArray) to natural break values (using ...
221 views

What's the most efficient way to load feature attributes into a numpy array?

I am currently working on an add-on that relies on the user choosing fields of tables (that can be from shapefiles, csv or dbf) that are open in QGIS and then making computations with such data. ...
222 views

Migrating data from Python to PostGIS

I have pandas DataFrame with these columns: point datetime value 1 Point(-24.6064453125 26.3683280945) 2014-09-11 19:00:00 24.885258 2 ...
2k views

Error "unsupported operand type(s) for +: 'int' and 'NoneType' for variance in python

I recently came up with an error in a script I am working with in Python for ArcGIS 10.1. The strange thing about it is that this script works for some files and not for others. Any ideas as to why ...
364 views

Convert WKT (or geojson) geometry to numpy array of coordinates

I am looking for the fastest way to convert WKT or geojson geometry from string to numpy array of coordinates. Is it possible to do it strictly in Python and without creating geometry object such ...
719 views

Installing pandas with Esri's python?

Trying to get pandas to import, but I'm getting what looks like an error caused by a failed dependency of the version of my Esri-provided numpy's compile, based on this stackoverflow posting. Here's ...
302 views

Save fails on raster object created from NumpyArrayToRaster [closed]

I am trying to save an ESRI grid built from a numpy array and am getting an error I've never seen before: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ...
542 views

How to change value of an individual pixel using arcpy?

I want to change the value of an individual pixel in a raster using arcpy. The code I wrote for changing the value is below, but it changes all of pixels in my raster. How can I set an individual ...
270 views

Why is matplotlib installed with ArcGIS?

Today I upgraded to ArcGIS Desktop 10.2.2 as well as the 64-bit background processing tool and noticed that both numpy and matplotlib were installed with Python. In fact, in the "What's New?" section ...
143 views

gdal_proximity distance to meters

I followed the answer given in this topic for searching the distance to the nearest coastline given a lat/lon coordinate. The distance output obtained is in degree (I think) but I need the distance ...
502 views

XYZ Clustering in Python and numpy arrays

I am looking for a method of clustering XYZ data in Python that works on numpy arrays. I know of a few sources, such as clusterpy and Pysal but have had little success with them as they seem to still ...
387 views

Print last digit in Numpy Array [closed]

I'm sure this is pretty basic, but is there a way to print a certain indexed portion of each segment in an array? For example, if I have the numpy array: ([1,2,3], [4,5,6], [7,8,9]) I'd like to ...
448 views

Creating numpy.array with variable number of fields to test arcpy.da.ExtendTable performance?

There was an ArcPy Café blog posting entitled Adding Fields: Performance Tips which advocated: Two approaches to help increase performance when adding numerous fields to a table or feature ...
219 views

How to calculate monthly maximum values from daily data in a 365 band grd?

I have a MINT2005.grd file which has 365 bands representing days of year from 2005. Each band is a 32x35 matrix representing the temperature at different latitude and longitude pair. How do I ...