# Tagged Questions

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.

211 views

### Tabulate Area using GDAL and Numpy

How could I perform a Tabulate Area using GDAL and Numpy? I am trying to summarize how many pixels of each class in a Landcover raster are within each polygon of a Census Blocks shapefile. I've ...
45 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, ...
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 ...
277 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 ...
17 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 ...
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 ...
99 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 ...
627 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] OPTIONS:...
545 views

### Buffering a Raster with GDAL and Numpy

I am using GDAL to convert a raster dataset into a numpy.array and then using numpy to buffer the data in the raster. For example, I need to know all the regions within 100ft of a school point ...
33 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 ...
86 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 ...
145 views

### Accelerating 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 ...
547 views

### Finding coordinates from a nested grid as a numpy array

So this is a pretty basic question, but I'm trying to figure it out. I've written a script that allows a user to read in a raster and provide a cell resolution, and outputs the amount of cells ...
487 views

### How do I use scipy.ndimage.gaussian_filter1d on an arbitrary axis?

I have a GDAL raster that looks like this: And I would really like to blur this raster along an arbitrary transect. I see that scipy.ndimage has a gaussian filter that allows me to blur the raster ...
37 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 = ...
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 ...
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. ...
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 ...
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). ...
131 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 ...
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 ...
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 ...
97 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 arcpy....
32 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 ...
168 views

### Efficient computation of path profile with Numpy and GDAL

I have numpy array with SRTM elevation data and I need calculate path profiles - vectors with elevation data from one point (transmitter) to every points of my map. Here's my current solution: def ...
291 views

### How to create multi-image single band single file geotiff?

I have a geotiff file that is single band but contains multiple subdatasets. I use gdal with numpy to open a specific subdataset and mask some of its values. Example: \$ gdalinfo sample.tif ... ...
286 views

### Averaging satellite data with missing values (using Python)

I am using sea surface temperature, chlorophyll, and other data parameters as covariants in a model, and I would like to average them over a particular time period. I am currently doing this using a ...
393 views

### ValueError when reading a raster band as a numpy array

Here's the problem shown in Python shell: In [32]: from osgeo import gdal In [33]: geotiff = '/Users/calvin/work/luc/proj_public/media/GLO /Users/calvin/work/luc/proj_public/media/...
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 ...
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 ...
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 ...
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*...
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,...
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 ...
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 ...
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 ...
134 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: ...
294 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 scipy.optimize.curve_fit....