cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cO OO cO This program writes the TransCom 3 Level 1 output data to a single OO cO netCDF file. OO cO OO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin notes OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO C C TRANSCOM MODELERS! C C PLEASE USE THE FOLLOWING CONVENTIONS WHEN FILLING THE LEVEL 1 ARRAYS: C (all the array descriptions are provided below) C C PLEASE WRITE THE GRIDCELL CENTERS ("LONVECT" AND "LATVECT" VECTORS) C IN UNITS OF DEGREES EAST (ie. -175, -170.......0, 5.....170, 175) AND C DEGREES NORTH (ie. -85, 80......0, 5......80, 85) C C PLEASE ENSURE THAT THE FIRST GRIDCELL IN 2D MAPS AND 3D FIELDS IS C - AT THE DATELINE RATHER THAN AT GREENWICH C - AT THE SOUTH POLE RATHER THAN THE NORTH POLE C - AT 1000 MB RATHER THAN 100 MB (FOR 3D FIELDS) C C THESE ARRAYS WILL THEN BE WRITTEN MOVING EAST (FOR LONGITUDINAL C DIRECTION), MOVING NORTH (FOR LATITUDINAL DIRECTION) AND MOVING UP C (FOR VERTICAL DIRECTION). C C PLEASE MAINTAIN THE BASIS FUNCTION REGION NUMBERING (ie. REGION 1 = C NORTH AMERICAN BOREAL, 2 = NORTH AMERICAN TEMPERATE......) C C UNITS: C - CO2 CONCENTRATION VALUES AS VOLUMETRIC PARTS PER MILLION (PPMV) C - SF6 CONCENTRATION VALUES AS VOLUMETRIC PARTS PER TRILLION (PPTV) C - U AND V WINDS IN METERS PER SECOND C - OMEGA WIND IN PASCALS/SECOND C C MISSING VALUES ARE REPORTED AS 1.0 x 10^36 C C LAND/SEA MASK ("LSMASK") AND TERRAIN MASK ("BETA") REPORT AS UNITLESS C FOLLOWING THE SAME GRIDDING RULES LISTED ABOVE. C C C ALLOCATABLE ARRAYS C C THIS PROGRAM HAS BEEN WRITTEN USING ALLOCATABLE ARRAYS. IF A C SUBROUTINE IS USED TO FILL THE OUTPUT ARRAYS, CODE MUST BE WRITTEN IN C THE INTERFACE SECTION (this is noted below). IF THE ARRAYS ARE FILLED C IN THE MAIN BODY OF THE PROGRAM, NO INTERFACE CODE IS REQUIRED. C C C To compile on Dendrus (SGI O2K) at Colorado State University: C C f90 make.output.l1.f -o make.l1 -I/usr/local/netcdf/include C -L/usr/local/lib -lnetcdf C cOOOOOOOOO end notes OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Program makeout cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin variable declarations OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Implicit none include 'netcdf.inc' cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc cccccccccc T3 modelers: adjust the following integer parameters!! cccccc integer, parameter :: im=72,jm=44,pm=9, ^ timestep=6, ^ tlen=365*timestep, ^ statcnt=228 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc integer :: c integer, parameter :: mtot =12,lreg=11, ^ windnum=2,tractot=26 real, dimension(:), allocatable :: lonvect,latvect, ^ presvect,mvect,lvect, ^ svect,tvect,trvect, ^ wvect real, dimension(:,:), allocatable :: lsmask real, dimension(:,:,:), allocatable :: ff90_s, ff90_sm1, ^ ff95_s, ff95_sm1, ^ bios_s, bios_sm1, ^ ocean_s,ocean_sm1, ^ u_s,v_s, ^ statco2,statwind real, dimension(:,:,:,:), allocatable :: ff90,ff95,bios,ocean, ^ u,v,omega,beta, ^ sf6_s,sf6_sm1, ^ landunit_s, ^ landunit_sm1, ^ oceanunit_s, ^ oceanunit_sm1 real, dimension(:,:,:,:,:), allocatable :: landunit,oceanunit,sf6 cOOOOOOOOO end variable declarations OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin main program variable description OOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO c c im : The number of longitudinal grid cells reported. c jm : The number of latitudinal grid cells reported. c pm : The number of pressure levels reported. c timestep : The number of timesteps per day reported for the high c frequency data reporting. c tlen : The total number of timesteps reported for the high c frequency data (timestep*365) c statcnt : The number of CO2 observational stations c mtot : The number of months written: 12 c lreg : The number of terrestrial basis function regions: 11 c windnum : The number of wind directions reported in the high c frequency data: 2 c tractot : The total number of tracers (number of basis functions c + 4 pre-subtracted tracers): 26 c lonvect : A vector containing the coordinates of the reported c longitudinal grid centers. First element starts near c the dateline and moves East. Units: degrees east c latvect : A vector containing the coordinates of the reported c latitudinal grid centers. First element starts near the c South Pole. Units: degrees north c presvect : A vector containing the coordinates of the reported c vertical grid centers in millibars. First element c starts at 1000 mb. c mvect : A vector of the month index: 1 through 12 c lvect : A vector of the region index: 1 through 11 c svect : A vector of the station index: 1 through 228 c tvect : A vector of the high frequency timestep index: 1 c through 2190 c trvect : A vector of the tracer index: 1 through 26 c wvect : A vector of the wind direction index: 1 through 2 c lsmask : Land/sea mask. This is a 2D array in which both c dimensions represent space. c ff90 : 1990 pre-subtracted fossil-fuel CO2 mixing ratio. This c is a 4D array in which the first 3 dimensions are space c and the last is time. c ff95 : 1995 pre-subtracted fossil-fuel CO2 mixing ratio. This c is a 4D array in which the first 3 dimensions are space c and the last is time. c bios : Neutral biosphere pre-subtracted CO2 mixing ratio. This c is a 4D array in which the first 3 dimensions are space c and the last is time. c ocean : Ocean exchange pre-subtracted CO2 mixing ratio. This is c a 4D array in which the first 3 dimensions are space c and the last is time. c ff90_s : 1990 pre-subtracted fossil-fuel CO2 surface layer c mixing ratio. This is a 3D array in which the first 2 c dimensions are space and the last is time. c ff90_sm1 : 1990 pre-subtracted fossil-fuel CO2 mixing ratio in c layer above the surface layer. This is a 3D array in c which the first 2 dimensions are space, last is time c ff95_s : 1995 pre-subtracted fossil-fuel CO2 surface layer c mixing ratio. This is a 3D array in which the first 2 c dimensions are space and the last is time. c ff95_sm1 : 1995 pre-subtracted fossil-fuel CO2 mixing ratio in c layer above the surface layer. This is a 3D array in c which the first 2 dimensions are space, last is time. c bios_s : Neutral biosphere pre-subtracted CO2 surface layer c mixing ratio. This is a 3D array in which the first 2 c dimensions are space and the last is time. c bios_sm1 : Neutral biosphere pre-subtracted CO2 mixing ratio in c layer above the surface layer. This is a 3D array in c which the first 2 dimensions are space, last is time. c ocean_s : Ocean exchange pre-subtracted CO2 surface layer mixing c ratio. This is a 3D array in which the first 2 c dimensions are space and the last is time. c ocean_sm1 : Ocean exchange pre-subtracted CO2 mixing ratio in layer c above the surface layer. This is a 3D array in which c the first 2 dimensions are space and the last is time. c landunit : Terrestrial carbon basis function CO2 mixing ratio. c This is a 5D array in which the first 3 dimensions are c space, the fourth indexes the basis function region, c and the last dimension is time. c oceanunit : Oceanic carbon basis function CO2 mixing ratio. This c is a 5D array in which the first 3 dimensions are c space, the fourth indexes the basis function region, c and the last dimension is time. c landunit_s : Terrestrial carbon basis function surface layer CO2 c mixing ratio. This is a 4D array in which the first 2 c dimensions are space, the 3rd dimension indexes the c basis function region, and the last dimension is time. c landunit_sm1 : Terrestrial carbon basis function CO2 mixing ratio in c layer above the surface layer. This is a 4D array in c which the first 2 dimensions are space, the 3rd c dimension indexes the basis function region, and the c last dimension is time. c oceanunit_s : Oceanic carbon basis function surface layer CO2 mixing c ratio. This is a 4D array in which the first 2 c dimensions are space, the 3rd dimension indexes the c basis function region, and the last dimension is time. c oceanunit_sm1: Oceanic carbon basis function CO2 mixing ratio in layer c above the surface layer. This is a 4D array in which c the first 2 dimensions are space, the 3rd dimension c indexes the basis function region, and the last c dimension is time. c sf6 : SF6 mixing ratio. This is a 5D array in which the first c 3 dimensions are space, the fourth indexes the basis c function region, and the last dimension is time. c sf6_s : Surface layer SF6 mixing ratio. This is a 4D array in c which the first 2 dimensions are space, the 3rd c dimension indexes the basis function region, and the c last dimension is time. c sf6_sm1 : SF6 mixing ratio in layer above the surface layer. This c is a 4D array in which the first 2 dimensions are c space, the 3rd dimension indexes the basis function c region, and the last dimension is time. c u : Longitudinal wind velocity. This is a 4D array in which c the first three dimensions are space, the last is time. c v : Latitudinal wind velocity. This is a 4D array in which c the first three dimensions are space, the last is time. c omega : vertical pressure velocity. This is a 4D array in which c the first three dimensions are space, the last is time. c u_s : Longitudinal surface wind velocity. This is a 3D array: c the first two dimensions are space, the last is time. c v_s : Meridional surface wind velocity. This is a 3D array: c the first two dimensions are space, the last is time. c statco2 : A 3D array containing the CO2 single point reporting c output. The first dimension indexes the station c location (please use the order listed in the TransCom c protocol), the second indexes the tracer, and the last c indexes time. Please use the following order for the c tracer dimension: the pre-subtracted 1990 fossil fuel, c the pre-subtracted 1995 fossil fuel, the neutral c biosphere, the pre-subtracted oceanic exchange, the c terrestrial basis functions (1 through 11), and the c oceanic basis functions (1 through 11). c statwind : A 3D array containing the wind single point reporting c output. The first dimension indexes the station c location, the second indexes the reported wind c direction: u and v, and the last indexes time. c beta : Terrain mask. This is a 4D array in which the c first three dimensions are space and the last is time. c cOOOOOOOOO end main program variable description OOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin interface module OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Interface COOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO C C TRANSCOM MODELERS! C C IF YOU ARE CALLING A SUBROUTINE TO FILL THE OUTPUT ARRAYS, AN C INTERFACE MODULE WILL BE REQUIRED HERE (due to the use of allocatable C arrays). C COOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Subroutine write_cdf_1(im,jm,pm,mtot,lreg,statcnt,tlen, ^ tractot,windnum, ^ lonvect,latvect,presvect,mvect,lvect, ^ svect,tvect,trvect,wvect, ^ ff90,ff90_s,ff90_sm1,ff95,ff95_s,ff95_sm1, ^ bios,bios_s,bios_sm1, ^ ocean,ocean_s,ocean_sm1, ^ landunit,landunit_s,landunit_sm1, ^ oceanunit,oceanunit_s,oceanunit_sm1, ^ sf6,sf6_s,sf6_sm1,u,u_s,v,v_s,omega, ^ statco2,statwind,lsmask,beta) integer :: im,jm,pm,mtot,lreg, ^ statcnt,tlen, ^ tractot,windnum real, dimension(:), intent(in):: lonvect,latvect, ^ presvect,mvect,lvect, ^ svect,tvect,trvect, ^ wvect real, dimension(:,:), intent(in):: lsmask real, dimension(:,:,:), intent(in):: ff90_s, ff95_sm1, ^ ff95_s, ff90_sm1, ^ bios_s, bios_sm1, ^ ocean_s,ocean_sm1, ^ u_s,v_s, ^ statco2,statwind real, dimension(:,:,:,:), intent(in):: ff90,ff95,bios,ocean, ^ u,v,omega,beta, ^ sf6_s,sf6_sm1, ^ landunit_s, ^ landunit_sm1, ^ oceanunit_s, ^ oceanunit_sm1 real, dimension(:,:,:,:,:),intent(in):: landunit,oceanunit,sf6 End Subroutine write_cdf_1 End interface cOOOOOOOOO end interface module OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin allocation of the TransCom3 level 1 arrays OOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Allocate(mvect (mtot )); mvect = (/(c,c=1,mtot) /) Allocate(lvect (lreg )); lvect = (/(c,c=1,lreg) /) Allocate(svect (statcnt)); svect = (/(c,c=1,statcnt)/) Allocate(tvect (tlen )); tvect = (/(c,c=1,tlen) /) Allocate(trvect(tractot)); trvect = (/(c,c=1,tractot)/) Allocate(wvect (windnum)); wvect = (/(c,c=1,windnum)/) Allocate(lonvect (im)) Allocate(latvect (jm)) Allocate(presvect (pm)) Allocate(lsmask (im,jm)) Allocate(ff90_s (im,jm,mtot)) Allocate(ff90_sm1 (im,jm,mtot)) Allocate(ff95_s (im,jm,mtot)) Allocate(ff95_sm1 (im,jm,mtot)) Allocate(bios_s (im,jm,mtot)) Allocate(bios_sm1 (im,jm,mtot)) Allocate(ocean_s (im,jm,mtot)) Allocate(ocean_sm1 (im,jm,mtot)) Allocate(u_s (im,jm,mtot)) Allocate(v_s (im,jm,mtot)) Allocate(ff90 (im,jm,pm,mtot)) Allocate(ff95 (im,jm,pm,mtot)) Allocate(bios (im,jm,pm,mtot)) Allocate(ocean (im,jm,pm,mtot)) Allocate(u (im,jm,pm,mtot)) Allocate(v (im,jm,pm,mtot)) Allocate(omega (im,jm,pm,mtot)) Allocate(beta (im,jm,pm,mtot)) Allocate(sf6_s (im,jm,lreg,mtot)) Allocate(sf6_sm1 (im,jm,lreg,mtot)) Allocate(landunit_s (im,jm,lreg,mtot)) Allocate(landunit_sm1 (im,jm,lreg,mtot)) Allocate(oceanunit_s (im,jm,lreg,mtot)) Allocate(oceanunit_sm1(im,jm,lreg,mtot)) Allocate(sf6 (im,jm,pm,lreg,mtot)) Allocate(landunit (im,jm,pm,lreg,mtot)) Allocate(oceanunit (im,jm,pm,lreg,mtot)) Allocate(statco2 (statcnt,tractot,tlen)) Allocate(statwind (statcnt,windnum,tlen)) cOOOOOOOOO end allocation of the TransCom3 level 1 arrays OOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin call to filler subroutine OOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO C C TRANSCOM MODELERS! C C FILL THE OUTPUT ARRAYS HERE. THIS CAN BE DONE WITH EITHER A SUBROUTINE C CALL (which requires code in the interface module above) OR PERFORMED C DIRECTLY IN THIS PORTION OF THE PROGRAM'S MAIN BODY. C cOOOOOOOOO end call to filler subroutine OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin call to write_cdf subroutine OOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Call write_cdf_1(im,jm,pm,mtot,lreg,statcnt,tlen, ^ tractot,windnum, ^ lonvect,latvect,presvect,mvect,lvect, ^ svect,tvect,trvect,wvect, ^ ff90,ff90_s,ff90_sm1,ff95,ff95_s,ff95_sm1, ^ bios,bios_s,bios_sm1, ^ ocean,ocean_s,ocean_sm1, ^ landunit,landunit_s,landunit_sm1, ^ oceanunit,oceanunit_s,oceanunit_sm1, ^ sf6,sf6_s,sf6_sm1,u,u_s,v,v_s,omega, ^ statco2,statwind,lsmask,beta) cOOOOOOOOO end call to write_cdf subroutine OOOOOOOOOOOOOOOOOOOOOOOOOOOO Write(*,*) 'output.L1.nc written' Stop End Program makeout cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cO WRITE_CDF_1 SUBROUTINE OO cO OO cO This subroutine writes all of the TransCom 3 level I output to a OO cO netCDF file called "output.L1.nc" OO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Subroutine write_cdf_1(im,jm,pm,mtot,lreg,statcnt,tlen, ^ tractot,windnum, ^ lonvect,latvect,presvect,mvect,lvect, ^ svect,tvect,trvect,wvect, ^ ff90,ff90_s,ff90_sm1,ff95,ff95_s,ff95_sm1, ^ bios,bios_s,bios_sm1, ^ ocean,ocean_s,ocean_sm1, ^ landunit,landunit_s,landunit_sm1, ^ oceanunit,oceanunit_s,oceanunit_sm1, ^ sf6,sf6_s,sf6_sm1,u,u_s,v,v_s,omega, ^ statco2,statwind,lsmask,beta) cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin variable declarations OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO implicit none include 'netcdf.inc' integer :: im,jm,pm,mtot,lreg, ^ statcnt,tlen, ^ tractot,windnum,r real, parameter :: misval=1.0e+36 real, dimension(:), intent(in) :: lonvect,latvect, ^ presvect,mvect,lvect, ^ svect,tvect,trvect, ^ wvect real, dimension(:,:), intent(in) :: lsmask real, dimension(:,:,:), intent(in) :: ff90_s, ff90_sm1, ^ ff95_s, ff95_sm1, ^ bios_s, bios_sm1, ^ ocean_s,ocean_sm1, ^ u_s,v_s, ^ statco2,statwind real, dimension(:,:,:,:), intent(in) :: ff90,ff95,bios,ocean, ^ u,v,omega,beta, ^ sf6_s,sf6_sm1, ^ landunit_s, ^ landunit_sm1, ^ oceanunit_s, ^ oceanunit_sm1 real, dimension(:,:,:,:,:), intent(in) :: landunit,oceanunit,sf6 character (len=10), dimension(lreg) :: sf6name character (len=80) :: regn character (len=2), dimension(lreg) :: num character (len=15), dimension(lreg) :: landname character (len=16), dimension(lreg) :: oceanname cccccccccc netCDF integer declarations ccccccccccccccccccccccccccccccccc integer :: status,ncid,imid,jmid, ^ pmid,mtotid,lregid, ^ statcntid,tlenid, ^ tractotid,windnumid, ^ lonid,latid,presid, ^ mid,lid,sid,tid,trid, ^ wid,ff90id,ff90_sid, ^ ff90_sm1id,ff95id, ^ ff95_sid,ff95_sm1id, ^ biosid,bios_sid, ^ bios_sm1id,oceanid, ^ ocean_sid,ocean_sm1id, ^ landunit_regid(11), ^ landunit_sid, ^ landunit_sm1id, ^ oceanunit_regid(11), ^ oceanunit_sid, ^ oceanunit_sm1id, ^ sf6_regid(11), ^ sf6_sid,sf6_sm1id, ^ uid,u_sid,vid,v_sid, ^ omegaid, ^ statCO2id,statwindid, ^ lsmaskid,betaid, ^ vdims2(2),vdims3(3), ^ vdims4(4), ^ start3(3),count3(3), ^ start4(4),count4(4) cOOOOOOOOO end variable declarations OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin variable description OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO c cccccccccc regular variables ccccccccccccccccccccccccccccccccccccccccccc c c misval : The designated TransCom missing value: 1.0e+36. c r : Loop index. Loops over lreg. c sf6name : A character array containing the variable names for c the series of netCDF arrays associated with the SF6 c basis function region 3D concentrations. c regn : A character variable used for the 'long_name' netCDF c attribute. c num : A character array containing the basis function region c number: 01 through 11. c landname : A character array containing the variable names for c the series of netCDF arrays associated with the CO2 c terrestrial basis function region 3D concentrations. c oceanname : A character array containing the variable names for c the series of netCDF arrays associated with the CO2 c oceanic basis function region 3D concentrations. c cccccccccc netcdf variables cccccccccccccccccccccccccccccccccccccccccccc c c ncid : The netCDF ID representing the open file. c XXXXXid : A series of ID's that correspond to those variables c names passed into the write_cdf subroutine. There are c three exceptions to this scheme. They are: c landunit_reg# : These ID's reduce the incoming landunit 5D array c into 4D arrays. There are 11 of these ID's, one c one for each terrestrial basis function region. c oceanunit_reg#: These ID's reduce the incoming oceanunit 5D array c into 4D arrays. There are 11 of these ID's, one c one for each oceanic basis function region. c sf6_reg# : These ID's reduce the incoming sf6 5D array c into 4D arrays. There are 11 of these ID's, one c one for each terrestrial basis function region. c vdims# : These are netCDF integer vectors whose elements c denote the dimensions of the netCDF arrays. c start# : These are netCDF integer vectors whose elements denote c where in the netCDF array the first element of a given c write statement should start. c count# : These are netCDF integer vectors whose elements denote c the edge lengths along each dimension of a given write c statement. c cOOOOOOOOO end variable description OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin variable initialization OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO sf6name(1) = 'sf6_reg_01'; num(1) = '01' sf6name(2) = 'sf6_reg_02'; num(2) = '02' sf6name(3) = 'sf6_reg_03'; num(3) = '03' sf6name(4) = 'sf6_reg_04'; num(4) = '04' sf6name(5) = 'sf6_reg_05'; num(5) = '05' sf6name(6) = 'sf6_reg_06'; num(6) = '06' sf6name(7) = 'sf6_reg_07'; num(7) = '07' sf6name(8) = 'sf6_reg_08'; num(8) = '08' sf6name(9) = 'sf6_reg_09'; num(9) = '09' sf6name(10) = 'sf6_reg_10'; num(10) = '10' sf6name(11) = 'sf6_reg_11'; num(11) = '11' landname(1) = 'landunit_reg_01' landname(2) = 'landunit_reg_02' landname(3) = 'landunit_reg_03' landname(4) = 'landunit_reg_04' landname(5) = 'landunit_reg_05' landname(6) = 'landunit_reg_06' landname(7) = 'landunit_reg_07' landname(8) = 'landunit_reg_08' landname(9) = 'landunit_reg_09' landname(10) = 'landunit_reg_10' landname(11) = 'landunit_reg_11' oceanname(1) = 'oceanunit_reg_01' oceanname(2) = 'oceanunit_reg_02' oceanname(3) = 'oceanunit_reg_03' oceanname(4) = 'oceanunit_reg_04' oceanname(5) = 'oceanunit_reg_05' oceanname(6) = 'oceanunit_reg_06' oceanname(7) = 'oceanunit_reg_07' oceanname(8) = 'oceanunit_reg_08' oceanname(9) = 'oceanunit_reg_09' oceanname(10) = 'oceanunit_reg_10' oceanname(11) = 'oceanunit_reg_11' cOOOOOOOOO end variable initialization OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO open netCDF file and define the dimensions OOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO status = NF_CREATE('output.L1.nc',0,ncid) write(*,*) 'output.L1.nc created' status = NF_DEF_DIM(ncid,'longitude',im,imid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'latitude',jm,jmid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'height',pm,pmid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'time',mtot,mtotid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'land_region',lreg,lregid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'station_count',statcnt,statcntid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'tlen',tlen,tlenid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'tracer_total',tractot,tractotid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_DIM(ncid,'wind_dir',windnum,windnumid) if (status .ne. nf_noerr) call handle_err(status) cOOOOOOOOO end open of netCDF file and dimension definition OOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin define variables OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cccccccccc vectors (latitude,longitude,pressure,time,regions) cccccccccc status = NF_DEF_VAR(ncid,'longitude',NF_FLOAT,1,imid,lonid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'latitude',NF_FLOAT,1,jmid,latid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'height',NF_FLOAT,1,pmid,presid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'time',NF_FLOAT,1,mtotid,mid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'land_region',NF_FLOAT,1,lregid,lid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'station_count',NF_FLOAT,1,statcntid,sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'tlen',NF_FLOAT,1,tlenid,tid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'tracer_total',NF_FLOAT,1,tractotid,trid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'wind_dir',NF_FLOAT,1,windnumid,wid) if (status .ne. nf_noerr) call handle_err(status) cccccccccc land/ocean mask (lsmask) cccccccccccccccccccccccccccccccccccc vdims2(1) = imid; vdims2(2) = jmid status = NF_DEF_VAR(ncid,'lsmask',NF_FLOAT,2,vdims2,lsmaskid) if (status .ne. nf_noerr) call handle_err(status) cccccccccc pre-subtracted carbon surface maps cccccccccccccccccccccccccc c ff90_s,ff90_sm1,ff95_s,ff95_sm1,bios_s,bios_sm1,ocean_s,ocean_sm1 vdims3(1) = imid; vdims3(2) = jmid; vdims3(3) = mtotid status = NF_DEF_VAR(ncid,'ff90_s',NF_FLOAT,3,vdims3,ff90_sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'ff90_sm1',NF_FLOAT,3,vdims3,ff90_sm1id) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'ff95_s',NF_FLOAT,3,vdims3,ff95_sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'ff95_sm1',NF_FLOAT,3,vdims3,ff95_sm1id) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'bios_s',NF_FLOAT,3,vdims3,bios_sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'bios_sm1',NF_FLOAT,3,vdims3,bios_sm1id) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'ocean_s',NF_FLOAT,3,vdims3,ocean_sid) if (status .ne. nf_noerr) call handle_err(status) status =NF_DEF_VAR(ncid,'ocean_sm1',NF_FLOAT,3,vdims3,ocean_sm1id) if (status .ne. nf_noerr) call handle_err(status) cccccccccc surface wind maps (u_s,v_s) ccccccccccccccccccccccccccccccccc status = NF_DEF_VAR(ncid,'u_s',NF_FLOAT,3,vdims3,u_sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'v_s',NF_FLOAT,3,vdims3,v_sid) if (status .ne. nf_noerr) call handle_err(status) cccccccccc pre-subtracted 3D carbon fields (ff90,ff95,bios,ocean) cccccc vdims4(1)=imid; vdims4(2)=jmid; vdims4(3)=pmid; vdims4(4)=mtotid status = NF_DEF_VAR(ncid,'ff90',NF_FLOAT,4,vdims4,ff90id) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'ff95',NF_FLOAT,4,vdims4,ff95id) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'bios',NF_FLOAT,4,vdims4,biosid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'ocean',NF_FLOAT,4,vdims4,oceanid) if (status .ne. nf_noerr) call handle_err(status) cccccccccc terrain mask (beta) ccccccccccccccccccccccccccccccccccccccccc status = NF_DEF_VAR(ncid,'beta',NF_FLOAT,4,vdims4,betaid) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D wind fields (u,v,omega) cccccccccccccccccccccccccccccccccc status = NF_DEF_VAR(ncid,'u',NF_FLOAT,4,vdims4,uid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'v',NF_FLOAT,4,vdims4,vid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'omega',NF_FLOAT,4,vdims4,omegaid) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D SF6 fields (sf6_reg1,sf6_reg2......) ccccccccccccccccccccc Do r = 1, lreg status = NF_DEF_VAR(ncid,sf6name(r),NF_FLOAT,4,vdims4, ^ sf6_regid(r)) if (status .ne. nf_noerr) call handle_err(status) End do cccccccccc SF6 surface maps (sf6_s,sf6_sm1) cccccccccccccccccccccccccccc vdims4(3) = lregid status = NF_DEF_VAR(ncid,'sf6_s',NF_FLOAT,4,vdims4,sf6_sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'sf6_sm1',NF_FLOAT,4,vdims4,sf6_sm1id) if (status .ne. nf_noerr) call handle_err(status) cccccccccc basis function surface maps ccccccccccccccccccccccccccccccccc c landunit_s,landunit_sm1,oceanunit_s,oceanunit_sm1 status = NF_DEF_VAR(ncid,'landunit_s',NF_FLOAT,4,vdims4, ^ landunit_sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'landunit_sm1',NF_FLOAT,4,vdims4, ^ landunit_sm1id) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'oceanunit_s',NF_FLOAT,4,vdims4, ^ oceanunit_sid) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,'oceanunit_sm1',NF_FLOAT,4,vdims4, ^ oceanunit_sm1id) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D basis function fields cccccccccccccccccccccccccccccccccccc c c landunit_reg1,landunit_reg2...., oceanunit_reg1,oceanunit_reg2....... vdims4(3) = pmid Do r = 1, lreg status = NF_DEF_VAR(ncid,landname(r),NF_FLOAT,4,vdims4, ^ landunit_regid(r)) if (status .ne. nf_noerr) call handle_err(status) status = NF_DEF_VAR(ncid,oceanname(r),NF_FLOAT,4,vdims4, ^ oceanunit_regid(r)) if (status .ne. nf_noerr) call handle_err(status) End do cccccccccc time series (statCO2,statwind) cccccccccccccccccccccccccccccc vdims3(1) = statcntid; vdims3(2) = tractotid; vdims3(3) = tlenid status =NF_DEF_VAR(ncid,'station_CO2',NF_FLOAT,3,vdims3,statCO2id) if (status .ne. nf_noerr) call handle_err(status) vdims3(1) = statcntid; vdims3(2) = windnumid; vdims3(3) = tlenid status = NF_DEF_VAR(ncid,'station_wind',NF_FLOAT,3,vdims3, ^ statwindid) if (status .ne. nf_noerr) call handle_err(status) cOOOOOOOOO end define variables OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin apply attributes OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cccccccccc The vectors (latitude,longitude,pressure,time,regions) cccccc status = NF_PUT_ATT_TEXT(ncid,lonid,'long_name',29, ^ 'Longitudinal gridcell centers') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,lonid,'units',12,'degrees_east') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,latid,'long_name',28, ^ 'Latitudinal gridcell centers') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,latid,'units',13,'degrees_north') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,presid,'long_name',25, ^ 'Vertical gridcell centers') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,presid,'units',9,'millibars') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,mid,'long_name',5,'month') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,mid,'units',5,'month') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,lid,'long_name',13,'region number') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,lid,'units',6,'region') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,sid,'long_name',14,'station number') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,sid,'units',7,'station') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,tid,'long_name',31, ^ 'elapsed hours in one year span') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,tid,'units',5,'hours') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,trid,'long_name',13,'tracer number') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,trid,'units',6,'tracer') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,wid,'long_name',21, ^ 'wind direction number') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,wid,'units',14,'wind direction') if (status .ne. nf_noerr) call handle_err(status) cccccccccc land/ocean mask (lsmask) cccccccccccccccccccccccccccccccccccc status = NF_PUT_ATT_TEXT(ncid,lsmaskid,'long_name',13, ^ 'Land/sea mask') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,lsmaskid,'units',8,'unitless') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,lsmaskid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc pre-subtracted carbon surface maps cccccccccccccccccccccccccc c ff90_s,ff90_sm1,ff95_s,ff95_sm1,bios_s,bios_sm1,ocean_s,ocean_sm1 status = NF_PUT_ATT_TEXT(ncid,ff90_sid,'long_name',47, ^ 'Pre-subtracted 1990 fossil fuel CO2 surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff90_sid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,ff90_sid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff95_sid,'long_name',47, ^ 'Pre-subtracted 1995 fossil fuel CO2 surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff95_sid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,ff95_sid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,bios_sid,'long_name',40, ^ 'Pre-subtracted biosphere CO2 surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,bios_sid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,bios_sid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ocean_sid,'long_name',38, ^ 'Pre-subtracted ocean CO2 surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ocean_sid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,ocean_sid,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff90_sm1id,'long_name',60, ^ 'Pre-subtracted 1990 fossil fuel CO2 map: layer above surface') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff90_sm1id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,ff90_sm1id,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff95_sm1id,'long_name',60, ^ 'Pre-subtracted 1995 fossil fuel CO2 map: layer above surface') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff95_sm1id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,ff95_sm1id,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,bios_sm1id,'long_name',53, ^ 'Pre-subtracted biosphere CO2 map: layer above surface') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,bios_sm1id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,bios_sm1id,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ocean_sm1id,'long_name',51, ^ 'Pre-subtracted oceanic CO2 map: layer above surface') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ocean_sm1id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status =NF_PUT_ATT_REAL(ncid,ocean_sm1id,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc surface wind maps (u_s,v_s)cccccccccccccccccccccccccccccccccc status = NF_PUT_ATT_TEXT(ncid,u_sid,'long_name',34, ^ 'Longitudinal surface wind velocity') if (status .ne. nf_noerr) call handle_err(status) status =NF_PUT_ATT_TEXT(ncid,u_sid,'units',17,'meters per second') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,u_sid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,v_sid,'long_name',32, ^ 'Meridional surface wind velocity') if (status .ne. nf_noerr) call handle_err(status) status =NF_PUT_ATT_TEXT(ncid,v_sid,'units',17,'meters per second') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,v_sid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc pre-subtracted 3D carbon fields (ff90,ff95,bios,ocean) cccccc status = NF_PUT_ATT_TEXT(ncid,ff90id,'long_name',44, ^ 'Pre-subtracted 1990 fossil fuel CO2 3D field') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff90id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,ff90id,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff95id,'long_name',44, ^ 'Pre-subtracted 1995 fossil fuel CO2 3D field') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,ff95id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,ff95id,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,biosid,'long_name',37, ^ 'Pre-subtracted biosphere CO2 3D field') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,biosid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,biosid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,oceanid,'long_name',35, ^ 'Pre-subtracted oceanic CO2 3D field') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,oceanid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,oceanid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc terrain mask (beta) ccccccccccccccccccccccccccccccccccccccccc status =NF_PUT_ATT_TEXT(ncid,betaid,'long_name',12,'Terrain mask') if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D wind fields (u,v,omega) cccccccccccccccccccccccccccccccccc status = NF_PUT_ATT_TEXT(ncid,uid,'long_name',26, ^ 'Longitudinal 3D wind field') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,uid,'units',17,'meters per second') if (status .ne. nf_noerr) call handle_err(status) status=NF_PUT_ATT_REAL(ncid,uid,'missing_value',NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,vid,'long_name',24, ^ 'Meridional 3D wind field') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,vid,'units',17,'meters per second') if (status .ne. nf_noerr) call handle_err(status) status=NF_PUT_ATT_REAL(ncid,vid,'missing_value',NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,omegaid,'long_name',22, ^ 'Vertical 3D wind field') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,omegaid,'units',18, ^ 'pascals per second') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,omegaid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D SF6 fields (sf6_reg1,sf6_reg2,sf6_reg3.......) ccccccccccc Do r = 1, lreg regn = 'SF6 basis function 3D concentration field: region ' ^ //num(r) status = NF_PUT_ATT_TEXT(ncid,sf6_regid(r),'long_name',52,regn) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,sf6_regid(r),'units',4,'pptv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,sf6_regid(r),'missing_value', ^ NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) End do cccccccccc SF6 surface maps (sf6_s,sf6_sm1) cccccccccccccccccccccccccccc status = NF_PUT_ATT_TEXT(ncid,sf6_sid,'long_name',30, ^ 'SF6 concentration map: surface') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,sf6_sid,'units',4,'pptv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,sf6_sid,'missing_value',NF_FLOAT,1, ^ misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,sf6_sm1id,'long_name',42, ^ 'SF6 concentration map: layer above surface') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,sf6_sm1id,'units',4,'pptv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,sf6_sm1id,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc basis function surface maps ccccccccccccccccccccccccccccccccc c landunit_s,landunit_sm1,oceanunit_s,oceanunit_sm1 status = NF_PUT_ATT_TEXT(ncid,landunit_sid,'long_name',38, ^ 'Terrestrial basis function surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,landunit_sid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,landunit_sid,'missing_value', ^ NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,oceanunit_sid,'long_name',34, ^ 'Oceanic basis function surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,oceanunit_sid,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,oceanunit_sid,'missing_value', ^ NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,landunit_sm1id,'long_name',50, ^ 'Terrestrial basis function layer above surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,landunit_sm1id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,landunit_sm1id,'missing_value', ^ NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,oceanunit_sm1id,'long_name',46, ^ 'Oceanic basis function layer above surface map') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,oceanunit_sm1id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,oceanunit_sm1id,'missing_value', ^ NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D basis function fields cccccccccccccccccccccccccccccccccccc c landunit_reg1,landunit_reg2...., oceanunit_reg1,oceanunit_reg2....... Do r = 1, lreg regn = '3D terrestrial basis function field: region '//num(r) status = NF_PUT_ATT_TEXT(ncid,landunit_regid(r),'long_name',46, ^ regn) if (status .ne. nf_noerr) call handle_err(status) status=NF_PUT_ATT_TEXT(ncid,landunit_regid(r),'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,landunit_regid(r), ^ 'missing_value',NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) regn = '3D oceanic basis function field: region '//num(r) status = NF_PUT_ATT_TEXT(ncid,oceanunit_regid(r),'long_name', ^ 42,regn) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,oceanunit_regid(r),'units',4, ^ 'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,oceanunit_regid(r), ^ 'missing_value',NF_FLOAT,1,misval) if (status .ne. nf_noerr) call handle_err(status) End do cccccccccc time series (statCO2,statwind) cccccccccccccccccccccccccccccc status = NF_PUT_ATT_TEXT(ncid,statCO2id,'long_name',38, ^ 'High frequency station CO2 time series') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,statCO2id,'units',4,'ppmv') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,statCO2id,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,statwindid,'long_name',39, ^ 'High frequency station wind time series') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_TEXT(ncid,statwindid,'units',17, ^ 'meters per second') if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_ATT_REAL(ncid,statwindid,'missing_value',NF_FLOAT, ^ 1,misval) if (status .ne. nf_noerr) call handle_err(status) cccccccccc close define mode ccccccccccccccccccccccccccccccccccccccccccc status = NF_ENDDEF(ncid) if (status .ne. nf_noerr) call handle_err(status) cOOOOOOOOO end apply attributes OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOO begin filling variables OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO status = NF_PUT_VAR_REAL(ncid,lonid,lonvect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,latid,latvect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,presid,presvect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,mid,mvect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,lid,lvect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,sid,svect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,tid,tvect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,trid,trvect) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VAR_REAL(ncid,wid,wvect) if (status .ne. nf_noerr) call handle_err(status) cccccccccc land/ocean mask (lsmask) cccccccccccccccccccccccccccccccccccc status = NF_PUT_VAR_REAL(ncid,lsmaskid,lsmask) if (status .ne. nf_noerr) call handle_err(status) cccccccccc pre-subtracted carbon surface maps cccccccccccccccccccccccccc c ff90_s,ff90_sm1,ff95_s,ff95_sm1,bios_s,bios_sm1,ocean_s,ocean_sm1 start3(1) = 1; start3(2) = 1; start3(3) = 1 count3(1) = im; count3(2) = jm; count3(3) = mtot status = NF_PUT_VARA_REAL(ncid,ff90_sid,start3,count3,ff90_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,ff95_sid,start3,count3,ff95_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,bios_sid,start3,count3,bios_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,ocean_sid,start3,count3,ocean_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,ff90_sm1id,start3,count3,ff90_sm1) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,ff95_sm1id,start3,count3,ff95_sm1) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,bios_sm1id,start3,count3,bios_sm1) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,ocean_sm1id,start3,count3, ^ ocean_sm1) if (status .ne. nf_noerr) call handle_err(status) cccccccccc surface wind maps (u_s,v_s)cccccccccccccccccccccccccccccccccc status = NF_PUT_VARA_REAL(ncid,u_sid,start3,count3,u_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,v_sid,start3,count3,v_s) if (status .ne. nf_noerr) call handle_err(status) cccccccccc pre-subtracted 3D carbon fields (ff90,ff95,bios,ocean) cccccc start4(1) = 1; start4(2) = 1; start4(3) = 1; start4(4) = 1 count4(1) = im; count4(2) = jm; count4(3) = pm; count4(4) = mtot status = NF_PUT_VARA_REAL(ncid,ff90id,start4,count4,ff90) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,ff95id,start4,count4,ff95) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,biosid,start4,count4,bios) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,oceanid,start4,count4,ocean) if (status .ne. nf_noerr) call handle_err(status) cccccccccc terrain mask (beta) ccccccccccccccccccccccccccccccccccccccccc status = NF_PUT_VARA_REAL(ncid,betaid,start4,count4,beta) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D wind fields (u,v,omega) cccccccccccccccccccccccccccccccccc status = NF_PUT_VARA_REAL(ncid,uid,start4,count4,u) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,vid,start4,count4,v) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,omegaid,start4,count4,omega) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D SF6 fields (sf6_reg1,sf6_reg2,sf6_reg3.......) ccccccccccc Do r = 1, lreg status = NF_PUT_VARA_REAL(ncid,sf6_regid(r),start4,count4, ^ sf6(:,:,:,r,:)) if (status .ne. nf_noerr) call handle_err(status) End do cccccccccc SF6 surface maps (sf6_s,sf6_sm1) cccccccccccccccccccccccccccc count4(3) = lreg status = NF_PUT_VARA_REAL(ncid,sf6_sid,start4,count4,sf6_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,sf6_sm1id,start4,count4,sf6_sm1) if (status .ne. nf_noerr) call handle_err(status) cccccccccc basis function surface maps ccccccccccccccccccccccccccccccccc c landunit_s,landunit_sm1,oceanunit_s,oceanunit_sm1 start4(1) = 1; start4(2) = 1; start4(3) = 1; start4(4) = 1 count4(1) = im; count4(2) = jm; count4(3) = lreg; count4(4) = mtot status = NF_PUT_VARA_REAL(ncid,landunit_sid,start4,count4, ^ landunit_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,oceanunit_sid,start4,count4, ^ oceanunit_s) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,landunit_sm1id,start4,count4, ^ landunit_sm1) if (status .ne. nf_noerr) call handle_err(status) status = NF_PUT_VARA_REAL(ncid,oceanunit_sm1id,start4,count4, ^ oceanunit_sm1) if (status .ne. nf_noerr) call handle_err(status) cccccccccc 3D basis function fields cccccccccccccccccccccccccccccccccccc c landunit_reg1,landunit_reg2...., oceanunit_reg1,oceanunit_reg2....... count4(3) = pm Do r = 1, lreg status = NF_PUT_VARA_REAL(ncid,landunit_regid(r),start4,count4, ^ landunit(:,:,:,r,:)) if (status .ne. nf_noerr) call handle_err(status) status =NF_PUT_VARA_REAL(ncid,oceanunit_regid(r),start4,count4, ^ oceanunit(:,:,:,r,:)) if (status .ne. nf_noerr) call handle_err(status) End do cccccccccc time series (statCO2,statwind) cccccccccccccccccccccccccccccc count3(1) = statcnt; count3(2) = tractot; count3(3) = tlen status = NF_PUT_VARA_REAL(ncid,statco2id,start3,count3,statco2) if (status .ne. nf_noerr) call handle_err(status) count3(1) = statcnt; count3(2) = windnum; count3(3) = tlen status = NF_PUT_VARA_REAL(ncid,statwindid,start3,count3,statwind) if (status .ne. nf_noerr) call handle_err(status) cOOOOOOOOO end filling variables OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOO close file and end subroutine OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO status = NF_CLOSE(ncid) if (status .ne. nf_noerr) call handle_err(status) Return End Subroutine write_cdf_1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cO Error-flagging subroutine OO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO cOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Subroutine Handle_err(status) Implicit none include 'netcdf.inc' integer :: status If (status .ne. nf_noerr) then Write(*,*) NF_STRERROR(status) Stop End if Return End subroutine handle_err