      subroutine LeafGasPrintToFiles(isitmassbased,indexunit,
     &ic3c4cam)
      implicit none
      integer isitmassbased,indexunit(20),paramunit,compareunit,
     &stomwuecicaoutunit,stomcompunit,wuecicacompunit,fluorescenceunit,
     &fluoresparamunit,aciempfitunit,alightempfitunit,ic3c4cam
      character *25,
     &              sitevars(50),unitsitevars(50),
     &              paramsvar(0:50),unitparamsvar(0:50),
     &              stomwuecica(200),unitstomwuecica(200),
     &              univcomvars(50),unitunivcomvars(50),
     &              univsumvars(50),unitunivsumvars(50),
     &              ACichars(50),unitACichars(50),
     &              ALightchars(50),unitALightchars(50),
     &cterm1,cterm2
      integer i

!$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
      paramunit=indexunit(1)
      compareunit=indexunit(2)
      stomwuecicaoutunit=indexunit(3)
      stomcompunit=indexunit(4)
      wuecicacompunit=indexunit(5)
      fluorescenceunit=indexunit(6)
      fluoresparamunit=indexunit(7)
      aciempfitunit=indexunit(8)
      alightempfitunit=indexunit(9)

!Fit for Amax_ACi and Asat_ALight
      ACichars(1)='CurveID'
      ACichars(2)='ACicurveNo'
      ACichars(3)='CiatZeroAnet'
      ACichars(4)='der_atCi'
      ACichars(5)='Amax_ACi'
      ACichars(6)='ACiIntercept'
      ACichars(7)='der_atInterceptCi'
      ACichars(8)='der_atACiend'
      ACichars(9)='PhiPSIImax_ACi'
      ACichars(10)='PhiPSIICiIntercept'
      ACichars(11)='der_atInterceptCi'
      ACichars(12)='der_atPhiPSIIendCi'
      ACichars(13)='ACiMaxCurvature'
      ACichars(14)='CO2i_ACiMaxcurva'
      ACichars(15)='PhiPSIIMaxCurvatCi'
      ACichars(16)='CO2i_PhiPSIIMaxCur'
      ACichars(17)='CaatZeroAnet'
      ACichars(18)='der_atCa'
      ACichars(19)='Amax_ACa'
      ACichars(20)='ACaIntercept'
      ACichars(21)='der_atInterceptCa'
      ACichars(22)='der_ACaat400ppm'
      ACichars(23)='anet_ACaat400ppm'
      ACichars(24)='PhiPSIImax_ACa'
      ACichars(25)='PhiPSIICaIntercept'
      ACichars(26)='der_atInterceptCa'
      ACichars(27)='der_atPhiPSIIendCa'
      ACichars(28)='ACaMaxCurvature'
      ACichars(29)='CO2a_ACaMaxcurva'
      ACichars(30)='PhiPSIIMaxCurvatCa'
      ACichars(31)='CO2a_PhiPSIIMaxCur'
      ACichars(32)='AveLeafTemp'
      ACichars(33)='AvePAR'
      ACichars(34)='AvepO2i'

      unitACichars(1)='NA'
      unitACichars(2)='NA'
      unitACichars(3)='Pa'
      unitACichars(4)='umolm-2s-1Pa-1'
      unitACichars(5)='umolm-2s-1'
      unitACichars(6)='umolm-2s-1'
      unitACichars(7)='umolm-2s-1Pa-1'
      unitACichars(8)='umolm-2s-1Pa-1'
      unitACichars(9)='NA'
      unitACichars(10)='NA'
      unitACichars(11)='Pa-1'
      unitACichars(12)='Pa-1'
      unitACichars(13)='X1000'
      unitACichars(14)='Pa'
      unitACichars(15)='X1000'
      unitACichars(16)='Pa'
      unitACichars(17)='Pa'
      unitACichars(18)='umolm-2s-1Pa-1'
      unitACichars(19)='umolm-2s-1'
      unitACichars(20)='umolm-2s-1'
      unitACichars(21)='umolm-2s-1Pa-1'
      unitACichars(22)='umolm-2s-1Pa-1'
      unitACichars(23)='umolm-2s-1'
      unitACichars(24)='NA'
      unitACichars(25)='NA'
      unitACichars(26)='Pa-1'
      unitACichars(27)='Pa-1'
      unitACichars(28)='X1000'
      unitACichars(29)='Pa'
      unitACichars(30)='X1000'
      unitACichars(31)='Pa'
      unitACichars(32)='oC'
      unitACichars(33)='umolm-2s-1'
      unitACichars(34)='Pa'
      if(isitmassbased.eq.1)then
        unitACichars(4)='umolkg-1s-1Pa-1'
        unitACichars(5)='umolkg-1s-1'
        unitACichars(6)='umolkg-1s-1'
        unitACichars(7)='umolkg-1s-1Pa-1'
        unitACichars(8)='umolkg-1s-1Pa-1'
        unitACichars(18)='umolkg-1s-1Pa-1'
        unitACichars(19)='umolkg-1s-1'
        unitACichars(20)='umolkg-1s-1'
        unitACichars(21)='umolkg-1s-1Pa-1'
        unitACichars(22)='umolkg-1s-1Pa-1'
        unitACichars(23)='umolkg-1s-1'
        unitACichars(33)='umolkg-1s-1'
      endif

      ALightchars(1)='CurveID'
      ALightchars(2)='ALightcurveNo'
      ALightchars(3)='PARatZeroAnet'
      ALightchars(4)='der_atPAR'
      ALightchars(5)='Asat_ALight'
      ALightchars(6)='ALightIntercept'
      ALightchars(7)='der_atIntercept'
      ALightchars(8)='der_atPARend'
      ALightchars(9)='PhiPSIILightIntercept'
      ALightchars(10)='der_atIntercept'
      ALightchars(11)='ExcessLightFactor'
      ALightchars(12)='der_atPAR1000'
      ALightchars(13)='ALightMaxCurvature'
      ALightchars(14)='PAR_MaxCurvature'
      ALightchars(15)='PhiPSIIALightMaxCur'
      ALightchars(16)='PAR_PhiPSIIMaxCurva'
      ALightchars(17)='AveLeafTemp'
      ALightchars(18)='AvepCO2ambient'
      ALightchars(19)='AvepO2i'

      unitALightchars(1)='NA'
      unitALightchars(2)='NA'
      unitALightchars(3)='umolm-2s-1'
      unitALightchars(4)='umol/umol'
      unitALightchars(5)='umolm-2s-1'
      unitALightchars(6)='umolm-2s-1'
      unitALightchars(7)='umol/umol'
      unitALightchars(8)='umol/umol'
      unitALightchars(9)='NA'
      unitALightchars(10)='umol-1m2s'
      unitALightchars(11)='NA'
      unitALightchars(12)='umol-1m2s'
      unitALightchars(13)='X1000'
      unitALightchars(14)='umolm-2s-1'
      unitALightchars(15)='X1000'
      unitALightchars(16)='umolm-2s-1'
      unitALightchars(17)='oC'
      unitALightchars(18)='Pa'
      unitALightchars(19)='Pa'
      if(isitmassbased.eq.1)then
        unitALightchars(3)='umolkg-1s-1'
        unitALightchars(5)='umolkg-1s-1'
        unitALightchars(6)='umolkg-1s-1'
        unitALightchars(10)='umol-1kgs'
        unitALightchars(12)='umol-1kgs'
        unitALightchars(14)='umolkg-1s-1'
        unitALightchars(16)='umolkg-1s-1'
      endif

      univcomvars(1)='CurveID'
      univcomvars(2)='FitRwp|Rch|ha?'
      univcomvars(3)='Fitha_Vcmax|Jmax|Tpu?'
      univcomvars(4)='FitGamma*|ha?'
      univcomvars(5)='FitKc|ha?'
      univcomvars(6)='FitKo|ha?'
      univcomvars(7)='FitRd|ha?'
      univcomvars(8)='FitAlpha?'
      univcomvars(9)='FitbetaPSII?'
      univcomvars(10)='CO2i_obs'
      univcomvars(11)='CO2i_Pred'
      univcomvars(12)='CO2c'
      univcomvars(13)='Anet_Obs'
      univcomvars(14)='Anet_Pred'
      univcomvars(15)='LimitState'
      univcomvars(16)='RecycRate'
      univcomvars(17)='CO2S'
      univcomvars(18)='Pres_O2'
      univcomvars(19)='Pres_H2O'
      univcomvars(20)='Pres_Air'
      univcomvars(21)='VPDL'
      univcomvars(22)='PARi'
      univcomvars(23)='LeafTemp'
      univcomvars(24)='ChamberAirTemp'
      univcomvars(25)='Trmmol'
      univcomvars(26)='StomatalCond_H2O'
      univcomvars(27)='ChlFlPHIPSII_Obs'
      univcomvars(28)='ChlFlPHIPSII_Pred'
      univcomvars(29)='CO2i_Pred_ChlFl'
      univcomvars(30)='Anet_Pred_ChlFl'
      univcomvars(31)='CO2c_CO2i_ChlFl'
      univcomvars(32)='CO2c_Anet_ChlFl'
    
      univcomvars(33)='fo_pam'
      univcomvars(34)='fm_pam'
      univcomvars(35)='fs_pam'
      univcomvars(36)='pam_measlight'
      univcomvars(37)='yield_ps2'
      univcomvars(38)='yield_npq'
      univcomvars(39)='qlake'
      univcomvars(40)='qpuddle'
      univcomvars(41)='kps2_norm'
      univcomvars(42)='knpq_norm'

      unitunivcomvars(1)='NA'
      unitunivcomvars(2)='1=No2=Yes'
      unitunivcomvars(3)='1=No2=Yes'
      unitunivcomvars(4)='1=No2=Yes'
      unitunivcomvars(5)='1=No2=Yes'
      unitunivcomvars(6)='1=No2=Yes'
      unitunivcomvars(7)='1=No2=Yes'
      unitunivcomvars(8)='1=No2=Yes'
      unitunivcomvars(9)='1=No2=Yes'
      unitunivcomvars(10)='Pa'
      unitunivcomvars(11)='Pa'
      unitunivcomvars(12)='Pa'
      unitunivcomvars(13)='umolm-2s-1'
      unitunivcomvars(14)='umolm-2s-1'
      unitunivcomvars(15)='Rubis1RUBP2TPU3'
      unitunivcomvars(16)='%'
      unitunivcomvars(17)='Pa'
      unitunivcomvars(18)='KPa'
      unitunivcomvars(19)='KPa'
      unitunivcomvars(20)='KPa'
      unitunivcomvars(21)='KPa'
      unitunivcomvars(22)='umolm-2s-1'
      unitunivcomvars(23)='oC'
      unitunivcomvars(24)='oC'
      unitunivcomvars(25)='mmolm-2s-1'
      unitunivcomvars(26)='molm-2s-1'
      unitunivcomvars(27)='NA'
      unitunivcomvars(28)='NA'
      unitunivcomvars(29)='Pa'
      unitunivcomvars(30)='umolm-2s-1'
      unitunivcomvars(31)='Pa'
      unitunivcomvars(32)='Pa'

      unitunivcomvars(33)='ArbitUnit'
      unitunivcomvars(34)='ArbitUnit'
      unitunivcomvars(35)='ArbitUnit'
      unitunivcomvars(36)='umolm-2s-1'
      unitunivcomvars(37)='0-1'
      unitunivcomvars(38)='0-1'
      unitunivcomvars(39)='0-1'
      unitunivcomvars(40)='0-1'
      unitunivcomvars(41)='kps2/(kf+kd)'
      unitunivcomvars(42)='knpq/(kf+fd)'

      if(isitmassbased.eq.1)then
        unitunivcomvars(13)='umolkg-1s-1'
        unitunivcomvars(14)='umolkg-1s-1'
        unitunivcomvars(22)='umolkg-1s-1'
        unitunivcomvars(25)='mmolkg-1s-1'
        unitunivcomvars(26)='molkg-1s-1'
        unitunivcomvars(30)='molkg-1s-1'
        unitunivcomvars(36)='umolkg-1s-1'
      endif

      write(compareunit,'(1000A)')(trim(univcomvars(i)),',',
     &i=1,31),trim(univcomvars(32))
      write(compareunit,'(1000A)')(trim(unitunivcomvars(i)),
     &',',i=1,31),trim(unitunivcomvars(32))

      paramsvar(0)='LimitState'
      paramsvar(1)='Vcmax25'
      paramsvar(2)='Jmax25'
      paramsvar(3)='Rdlight25'   
      paramsvar(4)='Resistwp25'
      paramsvar(5)='Resistch25'
      paramsvar(6)='tpu25'
      paramsvar(7)='gamma*25' 
      paramsvar(8)='fkc25'  
      paramsvar(9)='fko25'
      paramsvar(10)='alpha'
      paramsvar(11)='ha_vcmax'
      paramsvar(12)='hd_vcmax'
      paramsvar(13)='sv_vcmax'
      paramsvar(14)='ha_jmax'
      paramsvar(15)='hd_jmax'
      paramsvar(16)='sv_jmax'
      paramsvar(17)='ha_tpu'
      paramsvar(18)='hd_tpu'
      paramsvar(19)='sv_tpu'
      paramsvar(20)='ha_gmeso'
      paramsvar(21)='hd_gmeso'
      paramsvar(22)='sv_gmeso'
      paramsvar(23)='ha_darkresp'
      paramsvar(24)='ha_stargamma'
      paramsvar(25)='ha_kc'
      paramsvar(26)='ha_ko'
      paramsvar(27)='phifactor'
      paramsvar(28)='thetafactor'
      paramsvar(29)='betaPSII'
      paramsvar(30)='numrubisco'
      paramsvar(31)='numrubp'
      paramsvar(32)='numtpu'
      paramsvar(33)='NumSamplePoints'
      paramsvar(34)='SumSquare'
      paramsvar(35)='Rdlight'
      paramsvar(36)='Resistwp'
      paramsvar(37)='Resistch'
      paramsvar(38)='gamma*'
      paramsvar(39)='co2iRubismax25'
      paramsvar(40)='co2iRuBpmax25'
      paramsvar(41)='anetRubismax25'
      paramsvar(42)='anetRuBpmax25'

      unitparamsvar(0)='Occurrence'
      unitparamsvar(1)='umolm-2s-1'
      unitparamsvar(2)='umolm-2s-1'
      unitparamsvar(3)='umolm-2s-1'   
      unitparamsvar(4)='Pasm2umol-1'
      unitparamsvar(5)='Pasm2umol-1'
      unitparamsvar(6)='umolm-2s-1'
      unitparamsvar(7)='Pa' 
      unitparamsvar(8)='Pa'   
      unitparamsvar(9)='Pa'
      unitparamsvar(10)='0_1'
      unitparamsvar(11)='kJmol-1'
      unitparamsvar(12)='kJmol-1'
      unitparamsvar(13)='KJmol-1K-1'
      unitparamsvar(14)='kJmol-1'
      unitparamsvar(15)='kJmol-1'
      unitparamsvar(16)='KJmol-1K-1'
      unitparamsvar(17)='kJmol-1'
      unitparamsvar(18)='kJmol-1'
      unitparamsvar(19)='KJmol-1K-1'
      unitparamsvar(20)='kJmol-1'
      unitparamsvar(21)='kJmol-1'
      unitparamsvar(22)='KJmol-1K-1'
      unitparamsvar(23)='kJmol-1'
      unitparamsvar(24)='kJmol-1'
      unitparamsvar(25)='kJmol-1'
      unitparamsvar(26)='kJmol-1'
      unitparamsvar(27)='NA'
      unitparamsvar(28)='NA'
      unitparamsvar(29)='NA'
      unitparamsvar(30)='rubispoints'
      unitparamsvar(31)='rubppoints'
      unitparamsvar(32)='tpupoints'
      unitparamsvar(33)='<=rubis+rubp+tpu'
      unitparamsvar(34)='NA'
      unitparamsvar(35)='umolm-2s-1'
      unitparamsvar(36)='Pasm2umol-1'
      unitparamsvar(37)='Pasm2umol-1'
      unitparamsvar(38)='Pa'
      unitparamsvar(39)='Pa'
      unitparamsvar(40)='Pa'
      unitparamsvar(41)='umolm-2s-1'
      unitparamsvar(42)='umolm-2s-1'

      if(isitmassbased.eq.1)then
        unitparamsvar(1)='umolkg-1s-1'
        unitparamsvar(2)='umolkg-1s-1'
        unitparamsvar(3)='umolkg-1s-1'   
        unitparamsvar(4)='Paskgumol-1'
        unitparamsvar(5)='Paskgumol-1'
        unitparamsvar(6)='umolkg-1s-1'
        unitparamsvar(35)='umolkg-1s-1'
        unitparamsvar(36)='Paskgumol-1'
        unitparamsvar(37)='Paskgumol-1'
        unitparamsvar(41)='umolkg-1s-1'
        unitparamsvar(42)='umolkg-1s-1'
      endif
    
      sitevars(1)='siteID'
      sitevars(2)='Latitude'
      sitevars(3)='Longitude'
      sitevars(4)='Elevation'
      sitevars(5)='yearsampled'
      sitevars(6)='sampledoy'
      sitevars(7)='GrowingSeasonStart'
      sitevars(8)='GrowingSeasonEnd'
      sitevars(9)='standage'
      sitevars(10)='CanopyHeight'
      sitevars(11)='LeafAreaIndex'
      sitevars(12)='species'
      sitevars(13)='avetimeresolution'
      sitevars(14)='avetimesampled'
      sitevars(15)='SampleHeight'
      sitevars(16)='Needleage'
      sitevars(17)='specificLAI'
      sitevars(18)='nitrogencontent'
      sitevars(19)='carboncontent'
      sitevars(20)='phosphoruscontent'
      sitevars(21)='woodporosity'
      sitevars(22)='sapwooddensity'
      sitevars(23)='leafratio'

      unitsitevars(1)='NA'
      unitsitevars(2)='DegNorthPositive'
      unitsitevars(3)='DegEastPositive'
      unitsitevars(4)='m'
      unitsitevars(5)='Year'
      unitsitevars(6)='DayofYear'
      unitsitevars(7)='DayofYear'
      unitsitevars(8)='DayofYear'
      unitsitevars(9)='years'
      unitsitevars(10)='m'
      unitsitevars(11)='m2m-2'
      unitsitevars(12)='species'
      unitsitevars(13)='minutes'
      unitsitevars(14)='HourFraction'
      unitsitevars(15)='m'
      unitsitevars(16)='days'
      unitsitevars(17)='cm2g-1'
      unitsitevars(18)='%'
      unitsitevars(19)='%'
      unitsitevars(20)='%'
      unitsitevars(21)='ring/diffuse'
      unitsitevars(22)='g/cm3'
      unitsitevars(23)='Unitless'
      if(ic3c4cam.eq.1)then
        write(paramunit,'(2000A)')(trim(univcomvars(i)),',',i=1,9),
     &(trim(paramsvar(i)),',',i=0,34),(trim(paramsvar(i)),',',i=39,42),
     &(trim(sitevars(i)),',',i=1,22),trim(sitevars(23))
        write(paramunit,'(2000A)')(trim(unitunivcomvars(i)),',',i=1,9),
     &(trim(unitparamsvar(i)),',',i=0,34),
     &(trim(unitparamsvar(i)),',',i=39,42),
     &(trim(unitsitevars(i)),',',i=1,22),trim(unitsitevars(23))
      endif
      if(ic3c4cam.eq.2)then
        write(paramunit,'(2000A)')trim(univcomvars(1)),',',
     &'Model,Vcmax25,c4aparslope,c4kp25,rdlight25,',
     &(trim(paramsvar(i)),',',i=30,34),
     &(trim(sitevars(i)),',',i=1,22),trim(sitevars(23))
        write(paramunit,'(2000A)')trim(unitunivcomvars(1)),',',
     &'NA,umolm-2s-1,CO2/photon,umolm-2s-1,umolm-2s-1,',
     &(trim(unitparamsvar(i)),',',i=30,34),
     &(trim(unitsitevars(i)),',',i=1,22),trim(unitsitevars(23))
      endif
      write(fluorescenceunit,'(1000A)')trim(univcomvars(1)),',',
     &(trim(univcomvars(i)),',',i=10,14),
     &(trim(univcomvars(i)),',',i=17,27),
     &(trim(paramsvar(i)),',',i=3,5),trim(paramsvar(7)),',',
     &trim(paramsvar(29)),',',trim(paramsvar(34)),',',
     &trim(paramsvar(23)),',',(trim(paramsvar(i)),',',i=36,37),
     &trim(paramsvar(24)),',',(trim(univcomvars(i)),',',i=33,41),
     &trim(univcomvars(42))
      write(fluorescenceunit,'(1000A)')trim(unitunivcomvars(1)),',',
     &(trim(unitunivcomvars(i)),',',i=10,14),
     &(trim(unitunivcomvars(i)),',',i=17,27),
     &(trim(unitparamsvar(i)),',',i=3,5),trim(unitparamsvar(7)),',',
     &trim(unitparamsvar(29)),',',trim(unitparamsvar(34)),',',
     &trim(unitparamsvar(23)),',',(trim(unitparamsvar(i)),',',i=36,37),
     &trim(unitparamsvar(24)),',',(trim(unitunivcomvars(i)),',',
     &i=33,41),trim(unitunivcomvars(42))

      cterm1='Flu.Anet.SumSqure'
      cterm2='Flu.Electron.SumS'
      write(fluoresparamunit,'(1000A)')trim(univcomvars(1)),',',
     &trim(paramsvar(2)),',',trim(paramsvar(3)),',',
     &trim(paramsvar(3)),'/0rch,',trim(paramsvar(4)),',',
     &trim(paramsvar(4)),'/0rch,',trim(paramsvar(5)),',',
     &trim(paramsvar(7)),',',trim(paramsvar(7)),'/0rch,',
     &(trim(paramsvar(i)),',',i=27,29),trim(paramsvar(29)),'/0rch,',
     &'fo_dark,fm_dark,resp_dark,temp_dark,',trim(cterm1),',',
     &trim(cterm2)
      write(fluoresparamunit,'(1000A)')trim(unitunivcomvars(1)),',',
     &trim(unitparamsvar(2)),',',trim(unitparamsvar(3)),',',
     &trim(unitparamsvar(3)),',',trim(unitparamsvar(4)),',',
     &trim(unitparamsvar(4)),',',trim(unitparamsvar(5)),',',
     &trim(unitparamsvar(7)),',',trim(unitparamsvar(7)),',',
     &(trim(unitparamsvar(i)),',',i=27,29),trim(unitparamsvar(29)),',',
     &'ArbitUnit,ArbitUnit,',trim(unitparamsvar(3)),',oC,',
     &trim(cterm1),',',trim(cterm2)

      write(aciempfitunit,'(2000A)')(trim(ACichars(i)),',',i=1,34),
     &(trim(sitevars(i)),',',i=1,22),trim(sitevars(23))
      write(aciempfitunit,'(2000A)')(trim(unitACichars(i)),',',i=1,34),
     &(trim(unitsitevars(i)),',',i=1,22),trim(unitsitevars(23))

      write(alightempfitunit,'(2000A)')
     &(trim(ALightchars(i)),',',i=1,19),
     &(trim(sitevars(i)),',',i=1,22),trim(sitevars(23))
      write(alightempfitunit,'(2000A)')
     &(trim(unitALightchars(i)),',',i=1,19),
     &(trim(unitsitevars(i)),',',i=1,22),trim(unitsitevars(23))
!------------------------------------------------
!$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
!Stomatal conductance, water use efficiency and ci/ca
      stomwuecica(1)='curveno'
      stomwuecica(2)='curvename'
      stomwuecica(3)='gswmeas_stom'
      stomwuecica(4)='gswCO2sLin'
      stomwuecica(5)='gswCO2iLin'         
      stomwuecica(6)='gswCO2iBall'
      stomwuecica(7)='gswCO2sRay'
      stomwuecica(8)='gswCO2iRay'
      stomwuecica(9)='gswDewar'         
      stomwuecica(10)='CO2i'
      stomwuecica(11)='CO2s'
      stomwuecica(12)='RH'
      stomwuecica(13)='gammas'
      stomwuecica(14)='vpd_surf'
      stomwuecica(15)='Pres_air'
      stomwuecica(16)='Anet_Meas'
         
      unitstomwuecica(1)='NA'
      unitstomwuecica(2)='NA'
      unitstomwuecica(3)='molm-2s-1'
      unitstomwuecica(4)='molm-2s-1'
      unitstomwuecica(5)='molm-2s-1'         
      unitstomwuecica(6)='molm-2s-1'
      unitstomwuecica(7)='molm-2s-1'
      unitstomwuecica(8)='molm-2s-1'
      unitstomwuecica(9)='molm-2s-1'         
      unitstomwuecica(10)='ppm'
      unitstomwuecica(11)='ppm'
      unitstomwuecica(12)='0-1'
      unitstomwuecica(13)='ppm'
      unitstomwuecica(14)='Pa'
      unitstomwuecica(15)='Pa'
      unitstomwuecica(16)='umolm-2s-1'
      if(isitmassbased.eq.1)then
        unitstomwuecica(3)='molkg-1s-1'
        unitstomwuecica(4)='molkg-1s-1'
        unitstomwuecica(5)='molkg-1s-1'         
        unitstomwuecica(6)='molkg-1s-1'
        unitstomwuecica(7)='molkg-1s-1'
        unitstomwuecica(8)='molkg-1s-1'
        unitstomwuecica(9)='molkg-1s-1'
        unitstomwuecica(16)='umolkg-1s-1'
      endif

      write(stomcompunit,'(100A)')(trim(stomwuecica(i)),',',
     &i=1,15),trim(stomwuecica(16))
      write(stomcompunit,'(100A)')(trim(unitstomwuecica(i)),',',
     &i=1,15),trim(unitstomwuecica(16))
!------------------------------------------------------------
      stomwuecica(1)='curveno'
      stomwuecica(2)='curvename'
      stomwuecica(3)='co2ambient'
      stomwuecica(4)='vpdl'
      stomwuecica(5)='WUEmeasured'         
      stomwuecica(6)='WUEmodeled'
      stomwuecica(7)='cicameasured'
      stomwuecica(8)='cicamodeled'
      stomwuecica(9)='IntrinsicWUE'        
      stomwuecica(10)='IntWUEModel'
      stomwuecica(11)='cccimeasured1'
      stomwuecica(12)='cccimodeled1'
      stomwuecica(13)='cccimeasured2'
      stomwuecica(14)='cccimodeled2'
      stomwuecica(15)='cccimeasured3'
      stomwuecica(16)='cccimodeled3'
      stomwuecica(17)='cccimeasured4'
      stomwuecica(18)='cccimodeled4'
      stomwuecica(19)='recycmeasured1'
      stomwuecica(20)='recycmodeled1'
      stomwuecica(21)='recycmeasured2'
      stomwuecica(22)='recycmodeled2'
      stomwuecica(23)='recycmeasured3'
      stomwuecica(24)='recycmodeled3'
      stomwuecica(25)='recycmeasured4'
      stomwuecica(26)='recycmodeled4'
      stomwuecica(27)='recycmeasured5'
      stomwuecica(28)='recycmodeled5'
      stomwuecica(29)='recycmeasured6'
      stomwuecica(30)='recycmodeled6'

      unitstomwuecica(1)='NA'
      unitstomwuecica(2)='NA'
      unitstomwuecica(3)='ppm'
      unitstomwuecica(4)='Pa'
      unitstomwuecica(5)='umolmmol-1'         
      unitstomwuecica(6)='umolmmol-1'
      unitstomwuecica(7)='NA'
      unitstomwuecica(8)='NA'
      unitstomwuecica(9)='umolmol-1'         
      unitstomwuecica(10)='umolmol-1'
      unitstomwuecica(11)='NA'
      unitstomwuecica(12)='NA'
      unitstomwuecica(13)='NA'
      unitstomwuecica(14)='NA'
      unitstomwuecica(15)='NA'
      unitstomwuecica(16)='NA'
      unitstomwuecica(17)='NA'
      unitstomwuecica(18)='NA'
      unitstomwuecica(19)='NA'
      unitstomwuecica(20)='NA'
      unitstomwuecica(21)='NA'
      unitstomwuecica(22)='NA'
      unitstomwuecica(23)='NA'
      unitstomwuecica(24)='NA'
      unitstomwuecica(25)='NA'
      unitstomwuecica(26)='NA'
      unitstomwuecica(27)='NA'
      unitstomwuecica(28)='NA'
      unitstomwuecica(29)='NA'
      unitstomwuecica(30)='NA'

      write(wuecicacompunit,'(200A)')(trim(stomwuecica(i)),',',
     &i=1,29),trim(stomwuecica(30))
      write(wuecicacompunit,'(200A)')(trim(unitstomwuecica(i)),',',
     &i=1,29),trim(stomwuecica(30))

      stomwuecica(1)='curveno'
      stomwuecica(2)='curvename'
      stomwuecica(3)='TotPoints'
      stomwuecica(4)='gswCO2ithresl'
      stomwuecica(5)='CO2AmbCurrent'         
      stomwuecica(6)='vpdl_ref'
      stomwuecica(7)='Ballg0CO2sLin'
      stomwuecica(8)='BallmCO2sLin'
      stomwuecica(9)='BallrsqsLin'         
      stomwuecica(10)='Ballg0CO2iLin'
      stomwuecica(11)='BallmCO2iLin'
      stomwuecica(12)='BallrsqiLin'
      stomwuecica(13)='Ballg0CO2s'
      stomwuecica(14)='BallmCO2s'
      stomwuecica(15)='Ballrsqs'
      stomwuecica(16)='Rayg0CO2s'
      stomwuecica(17)='RaymCO2s'
      stomwuecica(18)='Rayd0CO2s'
      stomwuecica(19)='RayrsqCO2s'
      stomwuecica(20)='Belindag0CO2s'
      stomwuecica(21)='Belindag1CO2s'
      stomwuecica(22)='Belindad0CO2s'
      stomwuecica(23)='BelindarsqCO2s'
      stomwuecica(24)='Dewarg0CO2i'
      stomwuecica(25)='DewarmCO2i'
      stomwuecica(26)='Deward0CO2i'
      stomwuecica(27)='DewarrsqCO2i'
      stomwuecica(28)='WUEref'
      stomwuecica(29)='der_WUEref'
      stomwuecica(30)='rsqwue'
      stomwuecica(31)='wuefit1'
      stomwuecica(32)='wuefit2'
      stomwuecica(33)='wuefit3'
      stomwuecica(34)='wuefit4'
      stomwuecica(35)='wuefit5'
      stomwuecica(36)='IntrWUEref'
      stomwuecica(37)='Intrder_WUEref'
      stomwuecica(38)='Intrrsqwue'
      stomwuecica(39)='Intrwuefit1'
      stomwuecica(40)='Intrwuefit2'
      stomwuecica(41)='Intrwuefit3'
      stomwuecica(42)='Intrwuefit4'
      stomwuecica(43)='Intrwuefit5'
      stomwuecica(44)='CiCa-1Ref'
      stomwuecica(45)='der_CiCa-1Ref'
      stomwuecica(46)='rsqCiCa-1'
      stomwuecica(47)='CiCa-1Fit1'
      stomwuecica(48)='CiCa-1Fit2'
      stomwuecica(49)='CiCa-1Fit3'
      stomwuecica(50)='CiCa-1Fit4'
      stomwuecica(51)='CiCa-1Fit5'
      stomwuecica(52)='MeanLfTemp'
      stomwuecica(53)='MeanAirTemp'
      stomwuecica(54)='MeanVPDL'
      stomwuecica(55)='MeanPARi'
      stomwuecica(56)='CcCi-1Ref'
      stomwuecica(57)='der_CcCi-1Ref'
      stomwuecica(58)='rsqCcCi-1'
      stomwuecica(59)='CcCi-1Fit1'
      stomwuecica(60)='CcCi-1Fit2'
      stomwuecica(61)='CcCi-1Fit3'
      stomwuecica(62)='CcCi-1Fit4'
      stomwuecica(63)='CcCi-1Fit5'
      stomwuecica(64)='CcCi-1Fit6'
      stomwuecica(65)='CcCi-2Ref'
      stomwuecica(66)='der_CcCi-2Ref'
      stomwuecica(67)='rsqCcCi-2'
      stomwuecica(68)='CcCi-2Fit1'
      stomwuecica(69)='CcCi-2Fit2'
      stomwuecica(70)='CcCi-2Fit3'
      stomwuecica(71)='CcCi-2Fit4'
      stomwuecica(72)='CcCi-2Fit5'
      stomwuecica(73)='CcCi-2Fit6'
      stomwuecica(74)='CcCi-3Ref'
      stomwuecica(75)='der_CcCi-3Ref'
      stomwuecica(76)='rsqCcCi-3'
      stomwuecica(77)='CcCi-3Fit1'
      stomwuecica(78)='CcCi-3Fit2'
      stomwuecica(79)='CcCi-3Fit3'
      stomwuecica(80)='CcCi-3Fit4'
      stomwuecica(81)='CcCi-3Fit5'
      stomwuecica(82)='CcCi-3Fit6'
      stomwuecica(83)='CcCi-4Ref'
      stomwuecica(84)='der_CcCi-4Ref'
      stomwuecica(85)='rsqCcCi-4'
      stomwuecica(86)='CcCi-4Fit1'
      stomwuecica(87)='CcCi-4Fit2'
      stomwuecica(88)='CcCi-4Fit3'
      stomwuecica(89)='CcCi-4Fit4'
      stomwuecica(90)='CcCi-4Fit5'
      stomwuecica(91)='CcCi-4Fit6'
      stomwuecica(92)='Recyc-1Ref'
      stomwuecica(93)='der_Recyc-1Ref'
      stomwuecica(94)='rsqRecyc-1'
      stomwuecica(95)='Recyc-1Fit1'
      stomwuecica(96)='Recyc-1Fit2'
      stomwuecica(97)='Recyc-1Fit3'
      stomwuecica(98)='Recyc-1Fit4'
      stomwuecica(99)='Recyc-1Fit5'
      stomwuecica(100)='Recyc-2Ref'
      stomwuecica(101)='der_Recyc-2Ref'
      stomwuecica(102)='rsqRecyc-2'
      stomwuecica(103)='Recyc-2Fit1'
      stomwuecica(104)='Recyc-2Fit2'
      stomwuecica(105)='Recyc-2Fit3'
      stomwuecica(106)='Recyc-2Fit4'
      stomwuecica(107)='Recyc-2Fit5'
      stomwuecica(108)='Recyc-3Ref'
      stomwuecica(109)='der_Recyc-3Ref'
      stomwuecica(110)='rsqRecyc-3'
      stomwuecica(111)='Recyc-3Fit1'
      stomwuecica(112)='Recyc-3Fit2'
      stomwuecica(113)='Recyc-3Fit3'
      stomwuecica(114)='Recyc-3Fit4'
      stomwuecica(115)='Recyc-3Fit5'
      stomwuecica(116)='Recyc-4Ref'
      stomwuecica(117)='der_Recyc-4Ref'
      stomwuecica(118)='rsqRecyc-4'
      stomwuecica(119)='Recyc-4Fit1'
      stomwuecica(120)='Recyc-4Fit2'
      stomwuecica(121)='Recyc-4Fit3'
      stomwuecica(122)='Recyc-4Fit4'
      stomwuecica(123)='Recyc-4Fit5'
      stomwuecica(124)='Recyc-5Ref'
      stomwuecica(125)='der_Recyc-5Ref'
      stomwuecica(126)='rsqRecyc-5'
      stomwuecica(127)='Recyc-5Fit1'
      stomwuecica(128)='Recyc-5Fit2'
      stomwuecica(129)='Recyc-5Fit3'
      stomwuecica(130)='Recyc-5Fit4'
      stomwuecica(131)='Recyc-5Fit5'
      stomwuecica(132)='Recyc-6Ref'
      stomwuecica(133)='der_Recyc-6Ref'
      stomwuecica(134)='rsqRecyc-6'
      stomwuecica(135)='Recyc-6Fit1'
      stomwuecica(136)='Recyc-6Fit2'
      stomwuecica(137)='Recyc-6Fit3'
      stomwuecica(138)='Recyc-6Fit4'
      stomwuecica(139)='Recyc-6Fit5'

      unitstomwuecica(1)='NA'
      unitstomwuecica(2)='NA'
      unitstomwuecica(3)='NA'
      unitstomwuecica(4)='ppm'
      unitstomwuecica(5)='ppm'         
      unitstomwuecica(6)='PA'
      unitstomwuecica(7)='molm-2s-1'
      unitstomwuecica(8)='NA'
      unitstomwuecica(9)='NA'         
      unitstomwuecica(10)='molm-2s-1'
      unitstomwuecica(11)='NA'
      unitstomwuecica(12)='NA'
      unitstomwuecica(13)='molm-2s-1'
      unitstomwuecica(14)='NA'
      unitstomwuecica(15)='NA'
      unitstomwuecica(16)='molm-2s-1'
      unitstomwuecica(17)='NA'
      unitstomwuecica(18)='Pa'
      unitstomwuecica(19)='NA'
      unitstomwuecica(20)='molm-2s-1'
      unitstomwuecica(21)='(kPa)^0.5'
      unitstomwuecica(22)='Pa'
      unitstomwuecica(23)='NA'
      unitstomwuecica(24)='molm-2s-1'
      unitstomwuecica(25)='NA'
      unitstomwuecica(26)='Pa'
      unitstomwuecica(27)='NA'
      unitstomwuecica(28)='umolmmol-1'
      unitstomwuecica(29)='umolmmol-1ppm-1'
      unitstomwuecica(30)='NA'
      unitstomwuecica(31)='NA'
      unitstomwuecica(32)='NA'
      unitstomwuecica(33)='NA'
      unitstomwuecica(34)='NA'
      unitstomwuecica(35)='NA'
      unitstomwuecica(36)='umolmol-1ppm-1'
      unitstomwuecica(37)='umolmol-1ppm-1'
      unitstomwuecica(38)='NA'
      unitstomwuecica(39)='NA'
      unitstomwuecica(40)='NA'
      unitstomwuecica(41)='NA'
      unitstomwuecica(42)='NA'
      unitstomwuecica(43)='NA'
      unitstomwuecica(44)='NA'
      unitstomwuecica(45)='ppm-1'
      unitstomwuecica(46)='NA'
      unitstomwuecica(47)='NA'
      unitstomwuecica(48)='NA'
      unitstomwuecica(49)='NA'
      unitstomwuecica(50)='NA'
      unitstomwuecica(51)='NA'
      unitstomwuecica(52)='oC'
      unitstomwuecica(53)='oC'
      unitstomwuecica(54)='Pa'
      unitstomwuecica(55)='umolm-2s-1'
      unitstomwuecica(56)='NA'
      unitstomwuecica(57)='ppm-1'
      unitstomwuecica(58)='NA'
      unitstomwuecica(59)='NA'
      unitstomwuecica(60)='NA'
      unitstomwuecica(61)='NA'
      unitstomwuecica(62)='NA'
      unitstomwuecica(63)='NA'
      unitstomwuecica(64)='NA'
      unitstomwuecica(65)='NA'
      unitstomwuecica(66)='ppm-1'
      unitstomwuecica(67)='NA'
      unitstomwuecica(68)='NA'
      unitstomwuecica(69)='NA'
      unitstomwuecica(70)='NA'
      unitstomwuecica(71)='NA'
      unitstomwuecica(72)='NA'
      unitstomwuecica(73)='NA'
      unitstomwuecica(74)='NA'
      unitstomwuecica(75)='ppm-1'
      unitstomwuecica(76)='NA'
      unitstomwuecica(77)='NA'
      unitstomwuecica(78)='NA'
      unitstomwuecica(79)='NA'
      unitstomwuecica(80)='NA'
      unitstomwuecica(81)='NA'
      unitstomwuecica(82)='NA'
      unitstomwuecica(83)='NA'
      unitstomwuecica(84)='ppm-1'
      unitstomwuecica(85)='NA'
      unitstomwuecica(86)='NA'
      unitstomwuecica(87)='NA'
      unitstomwuecica(88)='NA'
      unitstomwuecica(89)='NA'
      unitstomwuecica(90)='NA'
      unitstomwuecica(91)='NA'
      unitstomwuecica(92)='NA'
      unitstomwuecica(93)='NA'
      unitstomwuecica(94)='NA'
      unitstomwuecica(95)='NA'
      unitstomwuecica(96)='NA'
      unitstomwuecica(97)='NA'
      unitstomwuecica(98)='NA'
      unitstomwuecica(99)='NA'
      unitstomwuecica(100)='NA'
      unitstomwuecica(101)='NA'
      unitstomwuecica(102)='NA'
      unitstomwuecica(103)='NA'
      unitstomwuecica(104)='NA'
      unitstomwuecica(105)='NA'
      unitstomwuecica(106)='NA'
      unitstomwuecica(107)='NA'
      unitstomwuecica(108)='NA'
      unitstomwuecica(109)='NA'
      unitstomwuecica(110)='NA'
      unitstomwuecica(111)='NA'
      unitstomwuecica(112)='NA'
      unitstomwuecica(113)='NA'
      unitstomwuecica(114)='NA'
      unitstomwuecica(115)='NA'
      unitstomwuecica(116)='NA'
      unitstomwuecica(117)='NA'
      unitstomwuecica(118)='NA'
      unitstomwuecica(119)='NA'
      unitstomwuecica(120)='NA'
      unitstomwuecica(121)='NA'
      unitstomwuecica(122)='NA'
      unitstomwuecica(123)='NA'
      unitstomwuecica(124)='NA'
      unitstomwuecica(125)='NA'
      unitstomwuecica(126)='NA'
      unitstomwuecica(127)='NA'
      unitstomwuecica(128)='NA'
      unitstomwuecica(129)='NA'
      unitstomwuecica(130)='NA'
      unitstomwuecica(131)='NA'
      unitstomwuecica(132)='NA'
      unitstomwuecica(133)='NA'
      unitstomwuecica(134)='NA'
      unitstomwuecica(135)='NA'
      unitstomwuecica(136)='NA'
      unitstomwuecica(137)='NA'
      unitstomwuecica(138)='NA'
      unitstomwuecica(139)='NA'
      if(isitmassbased.eq.1)then
        unitstomwuecica(7)='molkg-1s-1'
        unitstomwuecica(10)='molkg-1s-1'
        unitstomwuecica(13)='molkg-1s-1'
        unitstomwuecica(16)='molkg-1s-1'
        unitstomwuecica(20)='molkg-1s-1'
        unitstomwuecica(24)='molkg-1s-1'
        unitstomwuecica(55)='umolkg-1s-1'
      endif

      write(stomwuecicaoutunit,'(2000A)')(trim(stomwuecica(i)),',',
     &i=1,139),(trim(sitevars(i)),',',i=1,22),trim(sitevars(23))
      write(stomwuecicaoutunit,'(2000A)')(trim(unitstomwuecica(i)),
     &',',i=1,139),(trim(unitsitevars(i)),',',i=1,22),
     &trim(unitsitevars(23))
      return
      end
