[gdal-dev] reproject python numpy binary swath/lat/lon

Joaquim Luis jluis at ualg.pt
Tue Jun 12 11:59:39 PDT 2012


David,

Would this help?

https://sites.google.com/site/mironehowtos/satellite/import-a-modis-l2-sst-hdf-grid

I do the projection using the geolocation arrays and an internal 
interpolation using a minimum curvature algorithm. Works pretty nicely 
with MODIS L2 SSTs and chlorophyll

Joaquim

> Rutger,
>
> Thanks for the reply.  I tried the s_srs tag and it still didn't 
> help.  I also tried using the -geoloc flag which I had tried earlier 
> too and still get the 441 out of 441 failed to transform error.  I 
> have tried PyTroll, but there KDTree algorithm seems to be too slow 
> for the amount of data I'm using (not sure why), I have contacted them 
> in the past.
>
> I'm attempting to project satellite data to an AWIPS grid.  Assuming I 
> have the grid defined correctly with proj4 parameters, I've been using 
> "+proj=latlong +datum=wgs84" as my s_srs parameters.  Does that sound 
> correct for satellite data?  So my command line call (still for 
> testing) becomes:
>
> gdalwarp -s_srs "+proj=latlong +datum=wgs84" \
> -te 59.844 -123.044 14.335 -65.091 \
> -ts 5120 5120 \
> -t_srs "+proj=lcc +lon_1=-95.000  +lon_0=-113.133 +lat_2=25.0001 
> +lat_1=24.9999 +lat_0=16.369" \
> -geoloc -of GTIFF \
> image.vrt out.tif
>
> The output grid is 5120x5120 and I wasn't sure if -te was lat/lon 
> points, but that's what I used.  -te has lat/lon of upper left pixel 
> of the grid and lat/lon of the lower right pixel of the grid.  Does 
> any of this look correct?  Thanks for the help.
>
> -Dave
>
> On 6/12/12 7:04 AM, gdal-dev-request at lists.osgeo.org wrote:
>> Message: 2
>> Date: Tue, 12 Jun 2012 02:08:21 -0700 (PDT)
>> From: Rutger<kassies at gmail.com>
>> To:gdal-dev at lists.osgeo.org
>> Subject: Re: [gdal-dev] reproject python numpy binary swath/lat/lon
>> Message-ID:<1339492101512-4980686.post at n6.nabble.com>
>> Content-Type: text/plain; charset=us-ascii
>>
>> Hello David,
>>
>> A while back i did some tests with GDAL geolocation arrays using 
>> MODIS swath
>> data. I found that specifying the "s_srs" tag when running gdalwarp 
>> gets rid
>> of the 'too many points' error, even if you already have a SRS in 
>> your VRT.
>> If you use gdalwarp, your target grid can be completely described by the
>> -t_srs -tr and -t switches. The Python equivalent of these are the
>> dataset.SetProjection() and dataset.SetGeoTransform(). Getting the 
>> input SRS
>> from only the coordinate values seems impossible to me, the SRS 
>> should be
>> either read from some metadata or specified by the user.
>>
>> For me the geolocation arrays worked technically well, and very 
>> convenient.
>> However. i found the resulting image quality very disappointing (for my
>> specific MODIS case) compared to MRTswath and Pyresample. This might 
>> be due
>> to the irregular coordinate grids as a result of the swiping image 
>> sensor or
>> something like that. Maybe in different cases it would give good quality
>> results.
>>
>> I ended up using the Pyresample module which is part from the Pytroll
>> project. See:
>> http://pytroll.org/index.html  http://pytroll.org/index.html
>> This worked great for my case.
>>
>>
>> Regards,
>> Rutger
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>



More information about the gdal-dev mailing list