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

learn more… | top users | synonyms

3
votes
1answer
52 views

Memory error in python when reclassifying array

I have a .tif that I read into an array (call it tifArray), and I would like to classify the array based on set of conditions: Where 1200 <= tifArray <= 4000, outputArray = 1 Where tifArray ...
0
votes
0answers
13 views

numpy.unique: ValueError: all the input arrays must have same number of dimensions

I'm trying to get the unique values of an array but am getting an error that doesn't make any sense. Here is my pseudo code: import numpy as np import gdal # I have a .tif file, call it ...
2
votes
0answers
28 views

How to get 4 values for different Indexes and names of rasters for set of points? [on hold]

I am trying to get 4 values for different Indexes and names of rasters for set of points, but get problem with defining function def extractIndex(raster, pathName). #List of Folders 4 Folders ...
4
votes
1answer
39 views

Getting pixel values at single point using rasterio

To get a single pixel value at a point in a raster using rasterio, there is an example here: https://github.com/mapbox/rasterio/pull/275 However, is there a direct API within rasterio (and not the ...
1
vote
0answers
43 views

Arcpy cannot find shapefile attribute [closed]

I want arcpy to perform the following: load a shapefile, prepare to edit it, open its attribute table, perform a numpy.digitize using the values of a certain attribute and some bins provided ...
0
votes
0answers
48 views

Create raster with decibel value from Geotiff Intensity using QGIS GDAL python

I have raster with intensity values and I want to create raster with decibel values, I work with QGIS GDAL, I use gdal_calc I do this from the terminal: gdal_calc.py -A input_image.tif ...
1
vote
0answers
105 views

Python with ArcGIS: import scikit-learn fails (bad numpy.dtype)

I am trying to install scikit-learn 0.17.1 (current) into my Python 2.7.3 that accompanies my ArcGIS 10.2. The installation through easy_install goes through smoothly, but I get the following error on ...
1
vote
0answers
34 views

Possible to resample tifs in numpy array? [closed]

I need to resample a large number of tif files. Is it possible to put the list of rasters in a numpy array and resample the array? I'm thinking this would be faster than looping through the list, but ...
1
vote
1answer
66 views

Modify 3D numpy array using interpolation

I have a 3D array that I want to interpolate the np.nan values along the z dimension, and I just want the changes to modify my existing array. However, the changes seems not to be working. I have a ...
3
votes
0answers
79 views

Select shape file by their coordinates behavior [closed]

I want to filter shapefiles by their latitude behaviour: If the latitudes of edges A and B are constantly decreasing or increasing then this class marked as correct, otherwise are incorrect. For ...
1
vote
0answers
74 views

Write stacks of GeoTIFF image to NetCDF by chunk size

I converted GeoTIFF image stacks to NetCDF file with writing data by Index order (layer by layer) (this was a main solution). The problem is, it writes slowly (for 25 images - 1Gb takes 90 seconds). ...
0
votes
0answers
23 views

Using numpy.dstack() for merging two 3D arrays but losing spatial reference.

The code is as following: >>> temp = numpy.dstack((spi_negative,spi_positive)) >>> >>> temp.shape (16, 126, 294) >>> out_ras = ...
1
vote
1answer
71 views

Anaconda and ArcGIS 10.1

I am having problems installing Anaconda with ArcGIS 10.1. My problem is specifically with pandas. ArcGIS python is my default python version. I installed python 0.16.2 in this version, which ...
-1
votes
2answers
38 views

applying equation on numpy array [closed]

I have a 3d array: >>> print arr_u_num [[[ nan -3.90149352 -1.21931281 -1.08366785] [ nan -2.07270503 -1.27621887 -0.89320389] [ nan -2.69618795 -1.98927089 ...
1
vote
1answer
59 views

how to save a raster after converted from numpy array?

I'm trying to save a raster after calculation in numpy array. Here is what I wrote: rasterSM = arcpy.NumPyArrayToRaster(SM, lowerLeft, cellSize, value_to_nodata=nodata) rasterSM2 = ...
1
vote
2answers
39 views

Trying to maintain spatial reference on newly created numpy array

I am trying to copy the values from raster into newly created array and then trying to save the array with same spatial reference as raster file inRas = arcpy.GetParameterAsText(0) double_layer = ...
0
votes
0answers
38 views

return _NumPyArrayToRaster(*args, **kwargs) ValueError

I am trying to make an array to raster from the defined array below. However, I keep getting this error: return _NumPyArrayToRaster(*args, **kwargs)ValueError: Argument in_array: A two or three ...
1
vote
0answers
83 views

TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.ndarray'

I am trying to insert a value for different group of percentile eg (0- 10 percentitle) value = 1. I saw an example over here and went to try it out How do I Calculate Grouped Percentiles or Batch ...
4
votes
2answers
250 views

Reconstructing MODIS time-series applying Savitzky-Golay Filter with Python/Numpy

I want to apply the 'Savitzky-Golay' (savgol) filter to my time series, MODIS dataset, to remove noise (i.e., cloud pixels, etc.) in my data. MODIS have quality flags that indicates the reliability of ...
4
votes
1answer
115 views

Optimizing Python GDAL ReadAsArray

I am using the GDAL ReadAsArray method to work with raster data using numpy (specifically reclassification). As my rasters are large, I process the arrays in blocks, iterating though each block and ...
1
vote
0answers
32 views

Read latitude/longitude to create new point grid at higher resolution

New to SE, needed to reformat my other question. Basically I'm looking at reading a CSV with longitude and latitude points (in this case housing exposure, simplified below): HUC4,Longitude,Latitude ...
0
votes
0answers
27 views

More pythonic approach to resolution increase of point locations

Excuse my first question being slightly more Numpy and less actual GIS, but it relates to latitude / longitude so I thought I'd give it a shot. Problem: I have a flat file with latitude and ...
2
votes
2answers
88 views

Numpy error when computing scores based on percentiles

I want to calculate scores in one field based on the percentile (in steps of 10) the row falls into in another field. I found a solution here (Calculating Percentiles in ArcMap?) that I tried out, ...
2
votes
1answer
62 views

Determining proportion of raster cells containing each value from list for many rasters in raster stack?

I wrote a function to determine the proportion of raster pixels that contain each of a list of values that I would be interested in. I then wrote a function to apply the previous function to a 3d ...
0
votes
0answers
362 views

Convert Raster to Numpy Array with only Arcpy and Numpy

All the articles I'm finding including GDAL or PIL(?) which I cannot use. So I am trying to convert a raster I have to a Numpy Array with Arcpy and Numpy and then calculate some statistics on it but ...
3
votes
2answers
169 views

Total count of values at each pixel in a raster stack/ 3d array

If you have an array with x, y and z dimensions, how can I create an array of x, y dimensions that holds a count of how many z values at each location (x,y) are noData? I would prefer to use numpy ...
1
vote
0answers
534 views

Reading, modifying and writing a geotiff with GDAL in python

I'm trying the learn the ropes of Remote Sensing image processing using Python GDAL bindings and numpy. As a first attempt, I'm reading a Landsat8 geotiff file, do a simple manipulation and write the ...
3
votes
1answer
247 views

Reclassify a raster value to -9999 and set it to the nodata value using python and or gdal

I modified a script which reclassifies a raster. It is based on the script by Roger in his blog (the second script) and it works pretty well.The problem I am facing is as follows: I would like to ...
0
votes
0answers
156 views

stack raster using GDAL and numpy dstack

I am testing Savitzky-Golay filter with my MODIS dataset. Currently I am testing for 10 rasters (but later on will use my whole dataset) only just to test how should I create my script. So my initial ...
3
votes
2answers
365 views

Raster reclassify using python, gdal and numpy

I would like to reclassify a raster file from a raster with 10 classes to a raster with 8 classes using pyhton, gdal and/or numpy. The classes are represented as integers. I have tried following the ...
0
votes
1answer
136 views

NumPy is missing, but fixing the environment variable removed my printer settings?

I recently installed regular Python on my workstation in addition to ArcGIS 10.2. Based on various things I found online, it seemed like the consensus was to install the full Python, because there are ...
1
vote
1answer
104 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 ...
3
votes
1answer
339 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 ...
3
votes
2answers
177 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 ...
0
votes
1answer
41 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 ...
1
vote
1answer
126 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 ...
3
votes
1answer
170 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 ...
2
votes
0answers
78 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 ...
1
vote
0answers
106 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 ...
1
vote
1answer
2k 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 = ...
2
votes
1answer
253 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 ...
3
votes
1answer
165 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 ...
1
vote
0answers
86 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 ...
1
vote
1answer
78 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 ...
1
vote
1answer
820 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 ...
-2
votes
1answer
121 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 ...
1
vote
1answer
365 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 ...
2
votes
0answers
116 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 ...
1
vote
1answer
213 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 ...
3
votes
2answers
324 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 ...