datm.buildnml.csh

#! /bin/csh -f

set exedir = $RUNDIR; cd $exedir

#------------------------------------------------------------------------------
# specify input data files
#------------------------------------------------------------------------------
# If the user changes any input datasets - be sure they have unique filenames.
# Do not duplicate existing input file names.
# Note that streams namelist input has the form
#      streams = 'stream1.txt year_align year_first year_last ',
#                'stream2.txt year_align year_first year_last ',
#                ...
#                'streamN.txt year_align year_first year_last '
# where
# streamN.txt is the stream description file containing input stream details
# year_first  is the first year of data that will be used
# year_last   is the last  year of data that will be used
# year_align  is the model year that will be aligned with data for year_first
#------------------------------------------------------------------------------

set DOMAINPATH = $DIN_LOC_ROOT/atm/datm7
set DOMAINFILE = $DOMAINPATH/domain.lnd.fv0.9x1.25_gx1v6.090309.nc

echo DOMAINFILE = $DOMAINFILE >! $CASEBUILD/datm.input_data_list


set FFN        = "unused "

cat >! datm_atm_in << EOF1
 &shr_strdata_nml
   dataMode       = 'CPLHIST'
   domainFile     = '$DOMAINFILE'
   streams        = 'CPLHIST.3Hrly.f09in.stream.Solar.txt 1 899 928 ',
                    'CPLHIST.3Hrly.f09in.stream.Precip.txt 1 899 928 ',
                    'CPLHIST.3Hrly.f09in.stream.Other.txt 1 899 928 ',
                    'presaero.stream.txt 1 1 1'
   vectors        = 'u:v'
   mapmask        = 'nomask',
                    'nomask',
                    'nomask',
                    'nomask'
   tintalgo       = 'coszen',
                    'nearest',
                    'linear',
                    'linear'
  /
EOF1

cat >! CPLHIST.3Hrly.f09in.stream.Solar.txt << EOF1
<streamstemplate>
      <general_comment>
         streams template for datm in CCSM4
      </general_comment>
<stream>
      <comment>
         Stream description file for CPL history 3-hourly Solar data at 0.9x1.25 resolution for testing for BGC spinup
      </comment>
      <dataSource>
         CPL
      </dataSource>
      <domainInfo>
         <variableNames>
            time        time
            doma_lon    lon
            doma_lat    lat
            doma_area   area
            doma_mask   mask
         </variableNames>
         <filePath>
            /fis/cgd/tss/BCN1850TR1f09g16_3Hrly
         </filePath>
         <fileNames>
            BCN1850TR1f09g16_3Hrly.cpl.ha2x3h_solar.domain.nc
         </fileNames>
      </domainInfo>
      <fieldInfo>
         <variableNames>
            a2x3h_Faxa_swndr     swndr
            a2x3h_Faxa_swvdr     swvdr
            a2x3h_Faxa_swndf     swndf
            a2x3h_Faxa_swvdf     swvdf
         </variableNames>
         <filePath>
            /ptmp/nanr/icase.mh6ka/hf_input/monthly
         </filePath>
         <tInterpAlgo>
            coszen
         </tInterpAlgo>
         <offset>
            -10800
         </offset>
         <fileNames>
          b40mh6ka1d002_3h.0899-01.nc
          b40mh6ka1d002_3h.0899-02.nc
          b40mh6ka1d002_3h.0899-03.n

          ....
          ....  (filled with missing years)
          ....
          b40mh6ka1d002_3h.0927-02.nc
          b40mh6ka1d002_3h.0928-09.nc
          b40mh6ka1d002_3h.0928-10.nc
          b40mh6ka1d002_3h.0928-11.nc
          b40mh6ka1d002_3h.0928-12.nc
         </fileNames>
      </fieldInfo>
      <!-- Information on the program that created this file -->
      <build_streams_documentation>
         This CCSM stream text file was created by build_streams using the command line:
               /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -t datm.template.streams.xml -b 1 -e 4 -s CPLHIST3Hrly.Solar
         For more information on build_streams:
             /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -help
      </build_streams_documentation>
</stream>

</streamstemplate>
EOF1

cat >! CPLHIST.3Hrly.f09in.stream.Precip.txt << EOF1
<streamstemplate>
      <general_comment>
         streams template for datm in CCSM4
      </general_comment>
<stream>
      <comment>
         Stream description file for CPL history 3-hourly Precip data at 0.9x1.25 resolution for testing for BGC spinup
      </comment>
      <dataSource>
         CPL
      </dataSource>
      <domainInfo>
         <variableNames>
            time        time
            doma_lon    lon
            doma_lat    lat
            doma_area   area
            doma_mask   mask
         </variableNames>
         <filePath>
            /fis/cgd/tss/BCN1850TR1f09g16_3Hrly
         </filePath>
         <fileNames>
            BCN1850TR1f09g16_3Hrly.cpl.ha2x3h_prec.domain.nc
         </fileNames>
      </domainInfo>
      <fieldInfo>
         <variableNames>
            a2x3h_Faxa_rainc     rainc
            a2x3h_Faxa_rainl     rainl
            a2x3h_Faxa_snowc     snowc
            a2x3h_Faxa_snowl     snowl
         </variableNames>
         <filePath>
            /ptmp/nanr/icase.mh6ka/hf_input/monthly
         </filePath>
         <tInterpAlgo>
            nearest
         </tInterpAlgo>
         <offset>
            -5400
         </offset>
         <fileNames>
          b40mh6ka1d002_3h.0899-01.nc
          b40mh6ka1d002_3h.0899-02.nc

          ....
          ....  (fill with missing years)
          ....

          b40mh6ka1d002_3h.0928-08.nc
          b40mh6ka1d002_3h.0928-09.nc
          b40mh6ka1d002_3h.0928-10.nc
          b40mh6ka1d002_3h.0928-11.nc
          b40mh6ka1d002_3h.0928-12.nc
         </fileNames>
      </fieldInfo>
      <!-- Information on the program that created this file -->
      <build_streams_documentation>
         This CCSM stream text file was created by build_streams using the command line:
               /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -t datm.template.streams.xml -b 1 -e 4 -s CPLHIST3Hrly.Precip
         For more information on build_streams:
             /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -help
      </build_streams_documentation>
</stream>
</streamstemplate>
EOF1

cat >! CPLHIST.3Hrly.f09in.stream.Other.txt << EOF1
<streamstemplate>
      <general_comment>
         streams template for datm in CCSM4
      </general_comment>
<stream>
      <comment>
         Stream description file for CPL history 3-hourly non-Precipitation and non-Solar data at 0.9x1.25 resolution for testing of BGC spinup
      </comment>
      <dataSource>
         CPL
      </dataSource>
      <domainInfo>
         <variableNames>
            time        time
            doma_lon    lon
            doma_lat    lat
            doma_area   area
            doma_mask   mask
         </variableNames>
         <filePath>
            /fis/cgd/tss/BCN1850TR1f09g16_3Hrly
         </filePath>
         <fileNames>
            BCN1850TR1f09g16_3Hrly.cpl.ha2x3h.domain.nc
         </fileNames>
      </domainInfo>
      <fieldInfo>
         <variableNames>
            a2x3h_Sa_z           z
            a2x3h_Sa_u           u
            a2x3h_Sa_v           v
            a2x3h_Sa_tbot        tbot
            a2x3h_Sa_ptem        ptem
            a2x3h_Sa_shum        shum
            a2x3h_Sa_pbot        pbot
            a2x3h_Faxa_lwdn      lwdn
            a2x3h_Sa_dens        dens
            a2x3h_Sa_pslv        pslv
         </variableNames>
         <filePath>
            /ptmp/nanr/icase.mh6ka/hf_input/monthly
         </filePath>
         <tInterpAlgo>
            linear
         </tInterpAlgo>
         <offset>
            -5400
         </offset>
         <fileNames>

          b40mh6ka1d002_3h.0899-01.nc
          b40mh6ka1d002_3h.0899-02.nc
          b40mh6ka1d002_3h.0899-03.nc
          b40mh6ka1d002_3h.0899-04.nc
          b40mh6ka1d002_3h.0899-05.nc
          b40mh6ka1d002_3h.0899-06.nc
          b40mh6ka1d002_3h.0899-07.nc

          ....
          .... (fill with missing years)
          ....

          b40mh6ka1d002_3h.0928-06.nc
          b40mh6ka1d002_3h.0928-07.nc
          b40mh6ka1d002_3h.0928-08.nc
          b40mh6ka1d002_3h.0928-09.nc
          b40mh6ka1d002_3h.0928-10.nc
          b40mh6ka1d002_3h.0928-11.nc
          b40mh6ka1d002_3h.0928-12.nc
         </fileNames>
      </fieldInfo>

      <!-- Information on the program that created this file -->
      <build_streams_documentation>
         This CCSM stream text file was created by build_streams using the command line:
               /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -t datm.template.streams.xml -b 1 -e 4 -s CPLHIST3Hrly.nonSolarNonPrecip
         For more information on build_streams:
             /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -help
      </build_streams_documentation>
</stream>
</streamstemplate>
EOF1

cat >! presaero.stream.txt << EOF1
<streamstemplate>
      <general_comment>
         streams template for datm in CCSM4
      </general_comment>
<stream>
      <comment>
         Stream description file for aerosol deposition
      </comment>
      <dataSource>
         presaero
      </dataSource>
      <domainInfo>
         <variableNames>
            time         time
            doma_lon      lon
            doma_lat      lat
            doma_area    area
            doma_mask    mask
         </variableNames>
         <filePath>
            /fis/cgd/tss/BCN1850TR1f09g16_3Hrly
         </filePath>
         <fileNames>
            BCN1850TR1f09g16_3Hrly.cpl.ha2x3h_solar.domain.nc
         </fileNames>
      </domainInfo>
      <fieldInfo>
         <variableNames>
            BCDEPWET   bcphiwet
            BCPHODRY   bcphodry
            BCPHIDRY   bcphidry
            OCDEPWET   ocphiwet
            OCPHIDRY   ocphidry
            OCPHODRY   ocphodry
            DSTX01WD   dstwet1
            DSTX01DD   dstdry1
            DSTX02WD   dstwet2
            DSTX02DD   dstdry2
            DSTX03WD   dstwet3
            DSTX03DD   dstdry3
            DSTX04WD   dstdry4
            DSTX04DD   dstwet4
         </variableNames>
         <filePath>

          $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero
         </filePath>
         <offset>
            0
         </offset>
         <fileNames>
            aerosoldep_monthly_1850_0.9x1.25_c090828.nc
         </fileNames>
      </fieldInfo>
      <!-- Information on the program that created this file -->
      <build_streams_documentation>
         This CCSM stream text file was created by build_streams using the command line:
               /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -t datm.template.streams.xml -s presaero -b 1 -e 1 -p $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero -c aerosoldep_monthly_1850_mean_1.9x2.5_c090421.nc -dp $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero -do aerosoldep_monthly_1850_mean_1.9x2.5_c090421.nc
         For more information on build_streams:
             /gpfs/proj2/fis/cgd/cseg/csm/collections/cesm1_0_beta05/scripts/ccsm_utils/Tools/build_streams -help
      </build_streams_documentation>
</stream>
</streamstemplate>
EOF1


$CASETOOLS/listfilesin_streams -input_data_list -t presaero.stream.txt >> $CASEBUILD/datm.input_data_list

cat >! datm_in << EOF1
  &datm_nml
    atm_in = 'datm_atm_in'
    decomp = '1d'
    factorFn = '$FFN'
    iradsw   = 1
    presaero = .true.
  /
EOF1