[Gdal-dev] IPCC raster format
Christopher Barker
Chris.Barker at noaa.gov
Fri Jun 16 12:50:39 EDT 2006
Ivan Lucena wrote:
> I am heading in the direction of writing a Python+GDAL script to do the
> task, but I am stuck in how to separate the cells. The Fortran code is
> doing it in just one command as you can see in the code.
Fixed format is native to Fortran, so it is easier there. there may be
some code in the SciPy project to read Fortran fixed format files, but
it's not too hard to do with Python. I've enclosed a script that does it
either with numpy or with straight python. I'm not sure numpy really
helps here as I don't think you can vectorize the conversion from ascii
to float.
Once you have all the numbers as numbers, you can use Numpy to make them
the binary shape (and type) you need from there.
Enclosed is a script (there's a flag at the top for whether you want to
use numpy or not) and a small sample data file that looks similar to
what you want.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
grd_sz xmin ymin xmax ymax n_cols n_rows n_months
0.50 0.25 -89.75 359.75 89.75 720 360 12
1111122222-9999-9999-9999-9999-9999-9999-9999-9999-9999 52 88 103 91 65 45 27 32-9999-9999-9999-9999-9999 11 20 22 25 27 26 27 28 31
29 28 30
-------------- next part --------------
A non-text attachment was scrubbed...
Name: junk.py
Type: text/x-python
Size: 1268 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060616/0a650acc/junk.py
More information about the Gdal-dev
mailing list