Data Distribution Centre | ||||||
News! We are currently developing a new website. To visit these pages, click here |
||||||
|
||||||
Climate Baseline File FormatThe files have been given an eight letter prefix and three letter suffix to make them compatible with all computers and media, thus the filename structure is: cxxxyyyy.dat An example, therefore, is "cpre1120.dat": which contains mean monthly 1911-1920 precipitation.
The files containing the observed climate data are in ASCII format with one file per year per variable. The first and second lines of the file contain information on the grid size, for example: grd_sz xmin ymin xmax ymax n_cols n_rows n_months missing This is followed by 12 monthly grids that are n_cols by n_rows in size. Each record contains n_cols (=720) columns longitude values, format 720i5, starting at xmin (= 0.25 deg East) and ending at xmax (=0.25 deg West) The first record starts at January, ymax (=89.75 deg North) and the last record is the row for December, ymin (=-89.75 deg South). Co-ordinates represent the centre of each grid cell. Missing values (Antarctica, oceans and major inland water bodies) are assigned integer values of -9999. To read in one year of data the following program should work: program rd_ascii ! ! f90 program to read in an integer ascii grid with ! variable dimensions into a global grid (720x360x12) ! parameter :: n_cols=720 parameter :: n_rows=360 integer, dimension (n_cols,n_rows,12) :: grid character(len=72) :: infl character(len=20) :: fmt ! call getarg(1,infl) ! if(infl.eq.' ')then write(*,*) 'Enter ascii grid file name' read(*,'(a72)')infl end if ! open(1,file=infl,status='old') read(1,*) read(1,*)xmin,ymin,xmax,ymax,ncols,nrows,nmonths,missing grid=missing fmt='( i5)' write(fmt(2:4),'(i3)')n_cols do im=1,nmonths do lat=1,n_rows read(1,fmt)(grid(lon,lat,im),lon=1,n_cols) enddo enddo ! end program rd_ascii |