[gdal-dev] reproject python numpy binary swath/lat/lon
David Hoese
dhoese at gmail.com
Mon Jun 4 08:50:31 PDT 2012
On 6/1/12 1:44 PM, Jose Gomez-Dans wrote:
> Hi David,
>
> On 1 June 2012 18:47, David Hoese <dhoese at gmail.com
> <mailto:dhoese at gmail.com>> wrote:
>
> I have 3 binary files, the image/swath 2D data and the
> corresponding 2D latitude and longitude pixel data from a previous
> processing step. The binary files were all created using numpy's
> tofile().
>
>
> the link you posted was mostly there. Basically, you create (in
> Python) the corresponding VRT files (you may want to use gdalbuildvrt
> to give you a flavour of how they look like). Once the files are in
> the system, you can reproject in python, using eg
> gdal.AutoCreateWarpedVRT, or gdal.ReprojectImage (see example here:
> http://jgomezdans.github.com/gdal_notes/reprojection.html).
>
> Using VRTs is quite nice if you are still going to do some further
> processing in Python/GDAL. You can convert to something like a GeoTIFF
> as a final stage.
>
> Anyway, hope that's useful
> J
Thanks Jose,
I looked at your notes and most of it makes sense to me except I'm still
having a few problems.
First, if I understand it correctly to get the GDAL utilities to use the
external GEOLOCATION files you have to specify the "-geoloc" on the
command line with programs like gdalwarp and gdal_translate. How do I
do that in the python API, or did I read something wrong? When I open
the VRT file and do a GetGeoTransform() I get the default (0, 1, 0, 0,
0, 1), which means its not getting the lat/lon data right? I'm also not
including any SRS tag in the VRT files because I was hoping GDAL would
get that information from the swath lat/lon files.
Second, I tried using gdalwarp as a test to get the data reprojected and
into a tiff. Initially it told me that I had too big of a file, so I
shrunk it down. Then I got the "Too many points (441 out of 441) failed
to transform" error message. I'm guessing this has to do with my
reprojection parameters (see next problem).
Third, for the moment I am trying to reproject to a specific grid where
I know the number of X and Y grid points as well as the type of
projection and the PROJ4 parameters that go along with that. I haven't
found anything about grids except GDALGridCreate which doesn't seem to
be in the python bindings. Any suggestions for how to do this with out
using command line calls?
-Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120604/aabd6591/attachment.html>
More information about the gdal-dev
mailing list