gdal

How I can i conditionally change the values in a numpy array taking into account nan numbers?

别等时光非礼了梦想. 提交于 2019-12-03 09:12:58
问题 My array is a 2D matrix and it has numpy.nan values besides negative and positive values: >>> array array([[ nan, nan, nan, ..., -0.04891211, nan, nan], [ nan, nan, nan, ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan], ..., [-0.02510989, -0.02520096, -0.02669156, ..., nan, nan, nan], [-0.02725595, -0.02715945, -0.0286231 , ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan]], dtype=float32) And I want to replace all the positive numbers with a number and all the negative

Read elevation using gdal python from geotiff

此生再无相见时 提交于 2019-12-03 07:54:43
问题 I am loading a geotiff file using GDAL. I have managed to read the coordinates X,Y but not the elevation. Has anyone worked on a similar case before ? Regards, 回答1: If you'd like the read all of the elevation values into a numpy array, you'd typically do something like this: from osgeo import gdal gdal.UseExceptions() ds = gdal.Open('test_data.tif') band = ds.GetRasterBand(1) elevation = band.ReadAsArray() print elevation.shape print elevation elevation will be a 2D numpy array. If you'd like

How to use GDAL to create geotiff from tiff and 4 corners latitude and longitude [closed]

这一生的挚爱 提交于 2019-12-03 07:46:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I have an image (map) without geo data in TIFF format. I need to get GeoTIFF file from my image. I have latitude and longitude for each corner of my map. How can I add my geo data to my image in Google spatial refence to get geotiff? I know that GDAL can help me with that. Can anyone help me build a command 回答1:

How to fix symbol lookup error: undefined symbol errors in a cluster environment

守給你的承諾、 提交于 2019-12-03 04:12:09
问题 I'm working on some python code that extracts some image data from an ECW file using GDAL (http://www.gdal.org/) and its python bindings. GDAL was built from source to have ECW support. The program is run on a cluster server that I ssh into. I have tested the program through the ssh terminal and it runs fine. However, I would now like to submit a job to the cluster using qsub, but it reports the following: Traceback (most recent call last): File "./gdal-test.py", line 5, in <module> from

GTiff mask with shapefile in python with gdal, ogr, etc

久未见 提交于 2019-12-03 03:40:36
OK, After a bit of fiddling, I've tweaked a script from the site hyperlink in the second comment line. The purpose of the script is to clip/mask a LARGE raster (i.e. that cannot fit into a 32-bit Python 2.7.5 application) in GTiff format with a shapefile with multiple polygons (each with a "Name" record) and save the clipped rasters into a "clip" sub-directory, where each masked grid is named after each polygon's "Name". Like the original script, it assumes that the GTiff and shapefile are in the same projection and overlap correctly, and it processes ~100 masks/sec. However, I have modified

How I can i conditionally change the values in a numpy array taking into account nan numbers?

£可爱£侵袭症+ 提交于 2019-12-03 00:46:31
My array is a 2D matrix and it has numpy.nan values besides negative and positive values: >>> array array([[ nan, nan, nan, ..., -0.04891211, nan, nan], [ nan, nan, nan, ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan], ..., [-0.02510989, -0.02520096, -0.02669156, ..., nan, nan, nan], [-0.02725595, -0.02715945, -0.0286231 , ..., nan, nan, nan], [ nan, nan, nan, ..., nan, nan, nan]], dtype=float32) And I want to replace all the positive numbers with a number and all the negative numbers with another number. How can I perform that using python/numpy? (For the record, the matrix is a

Install GDAL in virtualenvwrapper environment

我是研究僧i 提交于 2019-12-02 23:40:18
I tried to install gdal (pip install gdal)in virtualenvwrapper environment but I got this error : error: command 'gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for gdal Failed to build gdal I tried also "pip install --no-install GDAL" but there is nooption --no-install what should I do !? Yes, installing GDAL in a venv is a doozy. Conveniently, I just wrote up the documentation on how to do so for my advisor's lab! While I am not savvy enough to pinpoint the exact cause of your error, I can give you a bunch of things to try to fix it. First,

Read elevation using gdal python from geotiff

早过忘川 提交于 2019-12-02 22:54:18
I am loading a geotiff file using GDAL. I have managed to read the coordinates X,Y but not the elevation. Has anyone worked on a similar case before ? Regards, If you'd like the read all of the elevation values into a numpy array, you'd typically do something like this: from osgeo import gdal gdal.UseExceptions() ds = gdal.Open('test_data.tif') band = ds.GetRasterBand(1) elevation = band.ReadAsArray() print elevation.shape print elevation elevation will be a 2D numpy array. If you'd like a quick plot of the values you can use matplotlib : import matplotlib.pyplot as plt plt.imshow(elevation,

How to use GDAL to create geotiff from tiff and 4 corners latitude and longitude [closed]

血红的双手。 提交于 2019-12-02 21:12:57
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. I have an image (map) without geo data in TIFF format. I need to get GeoTIFF file from my image. I have latitude and longitude for each corner of my map. How can I add my geo data to my image in Google spatial refence to get geotiff? I know that GDAL can help me with that. Can anyone help me build a command You have the right idea in your answer but allow me to expand. You are correct, you'll need to use the gdal

How to fix symbol lookup error: undefined symbol errors in a cluster environment

≡放荡痞女 提交于 2019-12-02 17:29:27
I'm working on some python code that extracts some image data from an ECW file using GDAL ( http://www.gdal.org/ ) and its python bindings. GDAL was built from source to have ECW support. The program is run on a cluster server that I ssh into. I have tested the program through the ssh terminal and it runs fine. However, I would now like to submit a job to the cluster using qsub, but it reports the following: Traceback (most recent call last): File "./gdal-test.py", line 5, in <module> from osgeo import gdal File "/home/h3/ctargett/.local/lib/python2.6/site-packages/GDAL-1.11.1-py2.6-linux-x86