Code Monkey home page Code Monkey logo

gdal-calculations's Introduction

Hi there ๐Ÿ‘‹

I'm universally known as Frankie, a long-time Debian Developer and FLOSS activist. I found my way into the free/open-source world in the mid-90s, thanks to my job and experiences after my degree in Computer Science. Currently, I'm mainly interested in geospatial technologies and methodologies in the context of remote sensing, but as many early geeks I have extensive experience in system administration and general computing, HPC, and other fields of ICT. My expertise includes C/C++, Tcl, Perl, Python, R and many *nix tools and tiny languages.

gdal-calculations's People

Contributors

lpinner avatar

Watchers

 avatar  avatar  avatar

gdal-calculations's Issues

Would like to be able to use logic to make edits

What steps will reproduce the problem?
1. Say I have two input data sets:

 1  0  0  0
 0  1  1  0
 0  0  1  1
 0  0  0  1

11 12 15 15
11 11 12 95
15 15 15 15
11 15 95 15

I need a elements 11 and 95 in the second to be 1s in the first.

Typically I would have done something like

first[second == 11] = 1
first[second == 95] = 1

How would I do this within the gdal_calculations framework.

What version of the product are you using? On what operating system?
0.8, CentOS 6.4, Python 2.6.6



Original issue reported on code.google.com by [email protected] on 18 Dec 2013 at 2:51

Shape of dataset isn't what was expected

What steps will reproduce the problem?
1. gdalinfo shows the shape of my tif file as (647, 553)
2. But using gdal_calculations...

g = gdal_calculations.Dataset (in_data_filename)
print g[0].shape

will show a shape of (12, 647).

What is the expected output? What do you see instead?
Expect the shape of each band to be (647, 553).

Am I thinking about this wrong?

What version of the product are you using? On what operating system?
0.8 on CentOS 6.4, Python 2.6.6

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Dec 2013 at 2:31

gdal_calculations does not handle rasters with positive N-S pixel resolutions (was Invalid dataset dimenions: 498 x -435)

I'm having some trouble getting gdal_calculations to work reliably with some 
inputs that I think should be working properly. It works great on occasion, but 
usually I get an error like:

RuntimeError: Invalid dataset dimensions : 498 x -435

Using those same two inputs in the raster calculator in QGIS with the same 
formula, it produces the expected output.

Command I'm running:
/usr/bin/python -m gdal_calculations --A /tmp/rastercalc7LCtaE.tif --B 
/tmp/rastercalc9lrqbS.tif --extent MAXOF --reproject --outfile 
/tmp/rastercalcZRb4Dh.tif --calc='(A[0] * B[0])'

I've attached the two files. They overlap nicely in QGIS, where the calculation 
works as expected. If it matters, I'm using GDAL 1.11.0 with Python 2.7.3.

Can you provide any guidance? Am I using it incorrectly, or is this a bug of 
some kind?

I'd like to use this as part of an automated process (hence the weird 
filenames), so having it highly reliable would be important to me. If it helps, 
I could provide a limited amount of funding for the support/consulting on this 
issue. Probably not a ton, but enough for a nice dinner or two at least!

You can reach me directly at chris (at) strategiccode.com if needed.

Thank you!
Chris Michaelis

PS. More output, if useful:


Python 2.7.3 (default, Feb 27 2014, 20:00:17)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import osgeo.gdal
>>> print osgeo.gdal.__version__
1.11.0
>>>


/usr/bin/python -m gdal_calculations --A /tmp/rastercalc7LCtaE.tif --B 
/tmp/rastercalc9lrqbS.tif --extent MAXOF --reproject --outfile 
/tmp/rastercalcZRb4Dh.tif --calc='(A[0] * B[0])' 2>&1
Running calculation
0Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/__main__.py", line 25, in <module>
    gdal_calculations.gdal_calculate.main()
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_calculate.py", line 235, in main
    outfile = eval(args.calc)
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_dataset.py", line 397, in __mul__
    return self.__operation__(operator.__mul__,other)
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_dataset.py", line 338, in __operation__
    dataset1,dataset2=self.check_extent(other)
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_dataset.py", line 80, in apply_environment
    dataset1,dataset2=self.__check_extent__(dataset1,dataset2)
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_dataset.py", line 184, in __check_extent__
    if dataset1.extent!=ext: dataset1=ClippedDataset(dataset1,ext)
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_dataset.py", line 713, in __init__
    self._dataset=gdal.Open(self._filename)
RuntimeError: Invalid dataset dimensions : 498 x -435

Original issue reported on code.google.com by [email protected] on 8 Jan 2015 at 7:45

Attachments:

gdal_calculate fails with ConvertedDataset

$ gdal_calculate --co "compress=lzw" --calc "Int16(x+0.5)" -x 
autotest/pyscripts/data/tgc_geo.tif --outfile tgc_geo.tif
0...10...20...30...40...50...60..Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/__main__.py", line 25, in <module>
    gdal_calculations.gdal_calculate.main()
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_calculate.py", line 218, in main
    outfile.save(args.outfile,args.outformat,args.creation_options)
  File "/usr/local/lib/python2.7/dist-packages/gdal_calculations/gdal_dataset.py", line 608, in __getattr__
    else:raise AttributeError("'Dataset' object has no attribute '%s'"%attr)
AttributeError: 'Dataset' object has no attribute 'save'

Original issue reported on code.google.com by [email protected] on 31 Oct 2013 at 4:04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.