<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I wrote a tool in c++ once to read this and if I recall correctly spit out arc/info ascii grid files. Its been a while since I looked at it so Ill need to dig it up and recheck exactly what it did. Pete can you remember if this is in the climate data processing wizard? I have no network access as I write this so I will only be able to confirm for you tomorrow what I actually have. Ivan if you still  have not found a suitable solution and Ill dig out what I have.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Regards</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Tim</DIV><DIV><BR><DIV><DIV>On 16/06/2006, at 12:08, Ivan Lucena wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"> <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> </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’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> </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 “Intergovernmental Panel on Climate Change” (IPCC) offers data on the web in a format described by this Fortran source code: (The file extension is just a generic “.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""=""><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""=""><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> </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""="">    grd_sz      xmin      ymin      xmax      ymax    n_cols    n_rows  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""="">      0.50      0.25    -89.75    359.75     89.75       720       360        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""="">…<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   52   88  103   91   65   45   27   32 …<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   11   20   22   25   27   26   27   28   31   29   28   30 …<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></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""="">It’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> </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’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 “-9999”;<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’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> </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> </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> </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> </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> </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> </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""="">'    grd_sz      xmin      ymin      xmax      ymax    n_cols    n_rows  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""="">'      0.50      0.25    -89.75    359.75     89.75       720       360        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> </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> </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       <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">  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">  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">  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">  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">  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">  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">!       <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">  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">    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">    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">  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">!       <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">  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">  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">  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">  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">  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">  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">  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">    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">      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">    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">  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">!       <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> </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="2" face="Arial"><SPAN style="font-size:10.0pt; font-family:Arial"><O:P> </O:P></SPAN></FONT></P> </DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Gdal-dev mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:Gdal-dev@lists.maptools.org">Gdal-dev@lists.maptools.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.maptools.org/mailman/listinfo/gdal-dev">http://lists.maptools.org/mailman/listinfo/gdal-dev</A></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Tim Sutton</DIV><DIV><A href="mailto:tim@linfiniti.com">tim@linfiniti.com</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></DIV></BODY></HTML>