! +-======-+ ! Copyright (c) 2003-2018 United States Government as represented by ! the Admistrator of the National Aeronautics and Space Administration. ! All Rights Reserved. ! ! THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, ! REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN ! COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS ! REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). ! THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN ! INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR ! REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, ! DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED ! HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE ! RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. ! ! Government Agency: National Aeronautics and Space Administration ! Government Agency Original Software Designation: GSC-15354-1 ! Government Agency Original Software Title: GEOS-5 GCM Modeling Software ! User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov ! Government Agency Point of Contact for Original Software: ! Dale Hithon, SRA Assistant, (301) 286-2691 ! ! +-======-+ Program binarytile implicit none integer, parameter :: unitR=7 integer, parameter :: unitW=8 integer, parameter :: NumGlobalVars=4 integer, parameter :: NumGridVars=3 integer :: N integer :: NT integer :: IM integer :: JM integer :: N_GRIDS real, allocatable :: AVR(:,:) real :: DUMMY character(len=128) :: NAME character(len=128) :: filenameIN character(len=128) :: filenameOUT call getarg(1,filenameIN) if (filenameIN == "") filenameIN = 'input' call getarg(2,filenameOUT) if (filenameOUT == "") filenameOUT = 'output' open(unit=unitR, file=filenameIN, form='FORMATTED') open(unit=unitW, file=filenameOUT,form='UNFORMATTED') READ (unitR, *) NT WRITE(unitW ) NT ! Number of grids that can be attached !------------------------------------- READ (unitR, *) N_GRIDS WRITE(unitW ) N_GRIDS ! The names and sizes of the grids to be tiled !--------------------------------------------- do N=1,N_GRIDS READ (unitR, *) NAME WRITE(unitW ) NAME READ (unitR, *) IM WRITE(unitW ) IM READ (unitR, *) JM WRITE(unitW ) JM enddo ! Read location stream file into AVR !--------------------------------------- allocate(AVR(NT,NumGlobalVars+NumGridVars*N_GRIDS)) do N=1, NT READ(unitR, *) AVR(N,1),AVR(N,10),AVR(N,2:6),DUMMY,AVR(N,7:9) end do close(unitR) do N=1,size(AVR,2) write(unitW) AVR(:,N) end do ! write(unitW) AVR(:,1:3) ! write(unitW) AVR(:,4:6) ! write(unitW) AVR(:,7:9) close(unitW) end Program binarytile