<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>Hi there,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>I would rather been watching the World Cup, but I
have to get this data in a usable format and there is no better place to get it
than from GDAL&#8217;s experts.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>The &#8220;Intergovernmental Panel on Climate Change&#8221;
(IPCC) offers data on the web in a format described by this Fortran source
code: (The file extension is just a generic &#8220;.dat&#8221;)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><a
href="http://ipcc-ddc.cru.uea.ac.uk/obs/observed_fileformat.html">http://ipcc-ddc.cru.uea.ac.uk/obs/observed_fileformat.html</a><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&gt; more cpre0130.dat<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
grd_sz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ymin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ymax&nbsp;&nbsp;&nbsp; n_cols&nbsp;&nbsp;&nbsp; n_rows&nbsp; n_months<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0.50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.25&nbsp;&nbsp;&nbsp;
-89.75&nbsp;&nbsp;&nbsp; 359.75&nbsp;&nbsp;&nbsp;&nbsp;
89.75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
720&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 360&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
12<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&#8230;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>-9999-9999-9999-9999-9999-9999-9999-9999-9999&nbsp;&nbsp;
52&nbsp;&nbsp; 88&nbsp; 103&nbsp;&nbsp; 91&nbsp;&nbsp; 65&nbsp;&nbsp;
45&nbsp;&nbsp; 27&nbsp;&nbsp; 32 &#8230;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>-9999-9999-9999-9999-9999&nbsp;&nbsp; 11&nbsp;&nbsp;
20&nbsp;&nbsp; 22&nbsp;&nbsp; 25&nbsp;&nbsp; 27&nbsp;&nbsp; 26&nbsp;&nbsp;
27&nbsp;&nbsp; 28&nbsp;&nbsp; 31 &nbsp;&nbsp;29 &nbsp;&nbsp;28 &nbsp;&nbsp;30 &#8230;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&#8230;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>It&#8217;s not hard to analyze the pattern on the
data or the code, so I figured that:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>- It&#8217;s an ASCII format;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>- There are two lines of reader (easy to read)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>- Each cell is 5 characters wide;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>- The no-data is &#8220;-9999&#8221;;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>- There is no separator between cells (what makes my
task difficult);<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>- It&#8217;s a multi-band raster dataset with 12
bands; (720x360x12 cells)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>- I am not sure if positive values can go beyond
9999 (that reminds me COBOL)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>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. I
am thing that maybe by using the NumPY stuff embedded in GDAL I could do the
same.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>Any Idea? Any experience with this data format?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>Thanks in advance,<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>Ivan<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>-------------------------------------------------------<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>This is a Python command line interaction with the
data:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&gt;&gt;&gt; import gdal<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&gt;&gt;&gt; f = open('C:/Data/IPCC/cpre0130.dat',
'r');<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&gt;&gt;&gt; f.readline()<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>'&nbsp;&nbsp;&nbsp;
grd_sz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ymin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ymax&nbsp;&nbsp;&nbsp; n_cols&nbsp;&nbsp;&nbsp; n_rows&nbsp; n_months\n'<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&gt;&gt;&gt; f.readline()<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0.50&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.25&nbsp;&nbsp;&nbsp;
-89.75&nbsp;&nbsp;&nbsp; 359.75&nbsp;&nbsp;&nbsp;&nbsp;
89.75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
720&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 360&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
12\n'<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>&gt;&gt;&gt; f.readline()<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>'-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>-------------------------------------------------------<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'>Fortran source code:<o:p></o:p></span></font></p>

<pre style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'><o:p>&nbsp;</o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>program rd_ascii&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>!<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>! f90 program to read in an integer ascii grid with<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>! variable dimensions into a global grid (720x360x12)<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>!<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; parameter :: n_cols=720<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; parameter :: n_rows=360<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; integer, dimension (n_cols,n_rows,12) :: grid<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; character(len=72) :: infl<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; character(len=20) :: fmt<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>!<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; call getarg(1,infl)<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; if(infl.eq.' ')then<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp;&nbsp;&nbsp; write(*,*) 'Enter ascii grid file name'<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp;&nbsp;&nbsp; read(*,'(a72)')infl<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; end if<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; open(1,file=infl,status='old')<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; read(1,*)<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; read(1,*)xmin,ymin,xmax,ymax,ncols,nrows,nmonths,missing<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; grid=missing<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; fmt='( i5)'<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; write(fmt(2:4),'(i3)')n_cols<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; do im=1,nmonths<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp;&nbsp;&nbsp; do lat=1,n_rows<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; read(1,fmt)(grid(lon,lat,im),lon=1,n_cols)<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp;&nbsp;&nbsp; enddo<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>&nbsp; enddo<o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></pre><pre
style='background:white'><font size=2 color="#333333" face="Courier New"><span
style='font-size:10.0pt;color:#333333'>end program rd_ascii<o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=1 face="Courier New"><span style='font-size:8.0pt;
font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>