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

0
votes
1answer
19 views

How to use gdal_calc.py for multi-band images?

My problem is that I have multi-band images (8 bands) in GEOTIFF format and I tried to use gdal_calc.py to calculate a conditional expression between those bands. However, I could not make it because ...
0
votes
0answers
27 views

Calculate exact percentile for each rastercell and create new raster with percentile values [closed]

I need to calculate the exact percentile value of each raster cell in a raster layer, in order to create a new raster layer with this exact (decimal) percentiles. (In excel this function would be "...
0
votes
0answers
22 views

How to create raster layer directly from numpy array in QGIS, without saving to file?

I have managed to create a numpy array from a raster file using commands from the gdal library, and now I would like to load that raster as a layer without saving it first. It seems like there should ...
0
votes
0answers
22 views

Scanning a raster by moving windows. Output rasters off by a cell. ArcGIS, python

I'm working in extracting smaller rasters from a bigger one (yellow). I'm using only python, some numpy maybe. I succesfully extracted a patch from a big raster, secuentially, by moving windows. So I ...
0
votes
1answer
30 views

Numpy raster reclassify outputs only 2 out of 6 classes

I have a raster (.tif) which I want to classify (6 classes) using gdal, python and numpy. The cell values range from: MIN = -30.9847 to MAX = 7.3505. From the first two answers in this question, I've ...
1
vote
1answer
46 views

Extracting small numpy array from a bigger raster, by moving windows. Memory issues. ArcGIS

I'm trying to extract a small raster from a bigger one, just using python and numpy (I'm not allow to use any other software). This code just reads a from a big raster, extracts an smaller window, ...
1
vote
0answers
38 views

Classifying data as Natural Breaks using ArcPy?

Is there any chance I can create a simple python script to classify my data as Natural Breaks? I have only created a script for quantile classification, but it is not enough for my work. arrp = ...
0
votes
0answers
35 views

I can't import arcpy to python in arcgis. What do I do?

I'm running ArcGIS 10.3 on Windows 10. I get an error message when I try to import arcpy. I'll include the error message that I print screened. Should I just un-install ArcGIS and reinstall it? or ...
2
votes
0answers
35 views

QGIS segmentation fault related to numpy on Ubuntu

I'm running QGIS 2.14 on Ubuntu 14.04 and everything's been working just fine until I upgraded a few Python packages via pip this afternoon. Since doing that, QGIS crashes with a segmentation fault ...
0
votes
1answer
57 views

NumPy to GeoTiff for use with Gdal

I have a few NumPy arrays: lat, lon, and 6 data bands. I'd like to convert these to GeoTiff and then apply the gdalwarp function, based on a specific projection, to each band. Is there a standard way ...
1
vote
0answers
20 views

Why can't get correct RGB img of Landsat 8 using np.dstack

I use np.dstack to stack Band4, Band3, and Band2 of Landsat8 data to get ture color image,I use code from Milos Miljkovic, but the result looks incorrect. import numpy as np from matplotlib import ...
1
vote
1answer
40 views

Statistical properties of raster image

I want to calculate mean and standard deviation of a raster image. In QGIS zonal statistics, we can calculate it within a polygon or a vector. But I want to calculate for whole image. In Python I'm ...
2
votes
1answer
21 views

Numpy TypeError when turning ndarray into structured array [closed]

I want to turn my ndarray(670911L, 39L) into a structured array using a view: c = arr.view(dtype=[(n, ‘float64’) for n in names]).reshape(len(arr)) where names is a list of 39 strings. But I am ...
1
vote
0answers
27 views

Create Diference TIFF image from two TIFFs

I am trying to use gdal_calc to calculate the differences between two almost identical images. The problem is that the images are tiffs with three bands (RGB) and the result is difficult to interpret. ...
1
vote
1answer
62 views

Calculating distances with SciPy and subsequently join identifiers

I have lots of start points and a handful of destination points. Using 'Point Distance' from the toolbox takes ages to calculate and write the results. Hence, I was looking for alternatives and went ...
2
votes
1answer
41 views

How to get value of uvIndex for a particular latitude and longitude from a grib2 file?

I'm trying to find out the uvIndex of a particular set of lat,lng. I'm getting the data file from this link. I'm using pygrib to read the file. import pygrib grbs = pygrib.open('uv.t12z.grbf01.grib2'...
3
votes
0answers
101 views

GDAL RasterIO performance in C++ vs ReadAsArray in python/numpy

I'm currently writing optimisations for a raster viewer program which uses gdal as it's base. It's currently written purely in python, and has some major speed issues which cause problems when we are ...
3
votes
1answer
127 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
1answer
97 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 inputRaster:...
2
votes
0answers
30 views

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

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 ...
5
votes
1answer
79 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
57 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 --calc="10*...
1
vote
0answers
170 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
38 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
121 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
90 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
133 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
28 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 = arcpy.NumPyArrayToRaster(temp,pnt,...
1
vote
1answer
98 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
62 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....
1
vote
1answer
65 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 = arcpy....
1
vote
2answers
41 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
47 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
132 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
388 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 ...
5
votes
2answers
213 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
44 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
33 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
114 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
73 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 ...
1
vote
1answer
487 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
195 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
1k 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
428 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
204 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 ...
5
votes
4answers
608 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
184 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
114 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
478 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 ...