program read c to read an ASCII file output by regrid.f c look at the header (first 7 lines) of the ASCII file and enter parameters below c character*80 filen character ggridspec*3 c c------------------------------------------------------------------------- c SET FOLLOWING PARAMETERS (use header (1st 7 lines) of ASCII file for assistance) c parameter (igridtype = 2) ! enter 1 for latxlon grid, and 2 for gaussian grid parameter (ncols = 192, nrows = 94) parameter (ggridspec = 'T62') ! IF gaussian grid, enter the spectral resolution c Note: R15,R21,R30,T21,T31,T42,&T62 resolutions are currently supported c c the following parameters need to be set only if lat x lon grid. If gaussian, you are done. c parameter (xllcorner = -180.0, yllcorner = -90.0) ! ignore if gaussian grid c c xllcorner = leftmost longitude, yllcorner = bottom latitude c xllcorner and yllcorner represents the lower left edge of pixel for a latxlon grid c for a gaussian grid, the xllcorner value represents the center value of pixel c c PARAMETER SETTING FINISHED. COMPILE AND RUN THE PROGRAM c------------------------------------------------------------------------- c real data(ncols,nrows) real lonm(ncols), latm(nrows) c real gaulatr15(40) ! define the gaussian lats used in the CCM2 grid real gaulatr21(56) ! define the gaussian lats used in the CSIRO grid real gaulatr30(80) ! define the gaussian lats used in the CSIRO grid real gaulatt21(32) ! define the gaussian lats used in the CGCM real gaulatt31(48) ! define the gaussian lats used in the CGCM real gaulatt42(64) ! define the gaussian lats used in the CCM2 grid real gaulatt62(94) ! define the gaussian lats used in the NCEP data c c character*80 title, units, ulon, ulat, ulevel, utime c character aname*21 c c R15: data gaulatr15 /-86.60,-82.19,-77.76,-73.32,-68.88,-64.43,-60.00, + -55.55,-51.11,-46.66,-42.22,-37.77,-33.33,-28.89, + -24.44,-20.00,-15.55,-11.11, -6.67, -2.22, 2.22, + 6.67, 11.11, 15.55, 20.00, 24.44, 28.89, 33.33, + 37.77, 42.22, 46.66, 51.11, 55.55, 60.00, 64.43, + 68.88, 73.32, 77.76, 82.19, 86.60/ c c R21 data gaulatr21 /-87.5613,-84.4022,-81.2245,-78.0425,-74.8590, + -71.6747,-68.4899,-65.3049,-62.1197,-58.9343,-55.7489,-52.5634, + -49.3779,-46.1924,-43.0068,-39.8211,-36.6355,-33.4498,-30.2642, + -27.0785,-23.8928,-20.7071,-17.5214,-14.3357,-11.1500,-7.9643, + -4.7786,-1.5929,1.5929,4.7786,7.9643,11.1500,14.3357,17.5214, + 20.7071,23.8928,27.0785,30.2642,33.4498,36.6355,39.8211,43.0068, + 46.1924,49.3779,52.5634,55.7489,58.9343,62.1197,65.3049,68.4899, + 71.6747,74.8590,78.0425,81.2245,84.4022,87.5613/ c c R30 data gaulatr30 /-88.2884,-86.0711,-83.8407,-81.6074,-79.3730, + -77.1380,-74.9027,-72.6673,-70.4317,-68.1960,-65.9603,-63.7245, + -61.4886,-59.2528,-57.0169,-54.7810,-52.5451,-50.3092,-48.0733, + -45.8374,-43.6014,-41.3655,-39.1295,-36.8936,-34.6576,-32.4217, + -30.1857,-27.9497,-25.7138,-23.4778,-21.2418,-19.0058,-16.7699, + -14.5339,-12.2979,-10.0619,-7.8259,-5.5900,-3.3540,-1.1180, + 1.1180,3.3540,5.5900,7.8259, 10.0619, 12.2979, 14.5339,16.7699, + 19.0058,21.2418,23.4778,25.7138,27.9497,30.1857,32.4217,34.6576, + 36.8936,39.1295,41.3655,43.6014,45.8374,48.0733,50.3092,52.5451, + 54.7810,57.0169,59.2528,61.4886,63.7245,65.9603,68.1960,70.4317, + 72.6673,74.9027,77.1380,79.3730,81.6074,83.8407,86.0711,88.2884/ c c T21 data gaulatt21 /85.761,80.269,74.745,69.213,63.679,58.143,52.607, + 47.070,41.532,35.995,30.458,24.920, + 19.382,13.844,8.307,2.769,-2.769, + -8.307,-13.844,-19.382,-24.920, + -30.458,-35.995,-41.532,-47.070, + -52.607,-58.143,-63.679,-69.213,-74.745,-80.269,-85.761/ c c T31 (or T32) data gaulatt31 /-87.1591,-83.4789,-79.777, + -76.0702,-72.3616,-68.652, + -64.9419,-61.2316,-57.521,-53.8103,-50.0995,-46.3886,-42.6776, + -38.9666,-35.2556,-31.5445,-27.8334,-24.1223,-20.4112,-16.7001, + -12.989,-9.2779,-5.5667,-1.8556, + 1.8556,5.5667,9.2779,12.989,16.7001, + 20.4112,24.1223,27.8334,31.5445,35.2556,38.9666,42.6776,46.3886, + 50.0995,53.8103,57.521,61.2316,64.9419,68.652,72.3616,76.0702, + 79.777,83.4789,87.1591/ c c T42: data gaulatt42 /-87.864,-85.097,-82.313,-79.526,-76.737,-73.948, + -71.158,-68.368,-65.578,-62.787, + -59.997,-57.207,-54.416,-51.626,-48.835,-46.045,-43.254, +-40.464,-37.673,-34.883, + -32.092,-29.301,-26.511,-23.720,-20.930,-18.139,-15.348, +-12.558, -9.767, -6.977, + -4.186, -1.395, 1.395, 4.186, 6.977, 9.767, 12.558, + 15.348, 18.139, 20.930, + 23.720, 26.511, 29.301, 32.092, 34.883, 37.673, 40.464, + 43.254, 46.045, 48.835, + 51.626, 54.416, 57.207, 59.997, 62.787, 65.578, 68.368, + 71.158, 73.948, 76.737, + 79.526, 82.313, 85.097, 87.864/ c c T62: data gaulatt62 /-88.542,-86.653,-84.753,-82.851,-80.947,-79.043, + -77.139,-75.235,-73.331,-71.426,-69.522,-67.617,-65.713,-63.808, + -61.903,-59.999,-58.094,-56.189,-54.285,-52.380,-50.475,-48.571, + -46.666,-44.761,-42.856,-40.952,-39.047,-37.142,-35.238,-33.333, + -31.428,-29.523,-27.619,-25.714,-23.809,-21.904,-20.000,-18.095, + -16.190,-14.286,-12.381,-10.476, -8.571, -6.667, -4.762, -2.857, + -0.952, 0.952, 2.857, 4.762, 6.667, 8.571, 10.476, 12.381, + 14.286, 16.190, 18.095, 20.000, 21.904, 23.809, 25.714, 27.619, + 29.523, 31.428, 33.333, 35.238, 37.142, 39.047, 40.952, 42.856, + 44.761, 46.666, 48.571, 50.475, 52.380, 54.285, 56.189, 58.094, + 59.999, 61.903, 63.808, 65.713, 67.617, 69.522, 71.426, 73.331, + 75.235, 77.139, 79.043, 80.947, 82.851, 84.753, 86.653, 88.542/ c c read the input ascii file c print *, 'enter input ascii file name e.g., /main/data.asc' read(*,'(a80)') filen c open (10,file=filen,status='unknown') do i = 1, 7 read (10,*) end do do 100 j = 1, nrows read (10,*) (data(i,j), i = 1, ncols) 100 continue c c c define latitude and longitude arrays (defines the center of a pixel) c if (igridtype.eq.1) then c xcellsize = 360. / float(ncols) ycellsize = 180. / float(nrows) do i = 1, ncols lonm(i) = xllcorner + xcellsize / 2. + (i - 1) * xcellsize end do do j = 1, nrows latm(j) = yllcorner + ycellsize / 2. + (nrows - j) * ycellsize end do c else c xcellsize = 360. / float(ncols) do i = 1, ncols lonm(i) = 0. + (i - 1) * xcellsize end do do j = 1, nrows if (ggridspec.eq.'R15') then latm(j) = -1. * gaulatr15(j) else if (ggridspec.eq.'R21') then latm(j) = -1. * gaulatr21(j) else if (ggridspec.eq.'R30') then latm(j) = -1. * gaulatr30(j) else if (ggridspec.eq.'T21') then latm(j) = gaulatt21(j) else if (ggridspec.eq.'T31') then latm(j) = -1. * gaulatt31(j) else if (ggridspec.eq.'T42') then latm(j) = -1. * gaulatt42(j) else if (ggridspec.eq.'T62') then latm(j) = -1. * gaulatt62(j) end if end do end if c c write out the values in a simple spreadsheet format c write (*,*) 'longitude, latitude, data' do j = 1, nrows do i = 1, ncols write (*,*) lonm(i), latm(j), data(i,j) end do end do c c stop end