Code Monkey home page Code Monkey logo

aerocom-data-correction-tools's People

Contributors

jgriesfeller avatar michaelschulzmetno avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aerocom-data-correction-tools's Issues

write script for sanity checks of submitted model data

  • test time axis (monotonously increasing; compare to year in file name; models should have always the same time step size)
  • test time bounds
  • test axis and bounds
  • test min and max values of variables
  • test for number of NaN values and complain if the percentage is high (model data)

implement INCA specifics

; specific for inca aerosol -  assembling the aerosol species tracers to species
       c_species=strmid(c_var,strpos(c_var,'_')+1,20)
       c_param=strmid(c_var,0,strpos(c_var,'_'))
       if modelfamily eq 'inca' then begin
         if strmatch(c_var,c_param+'_AER') or strmatch(c_var,c_param+'_PM10') then begin
           iis=where(tm eq c_param+'_ASSO4M',i_counts)
           if i_counts lt 1 then iis=where(tm eq c_param+'_SO4',i_counts)
           iip=where(tm eq c_param+'_ASPOMM',i_countp)
           iib=where(tm eq c_param+'_ASBCM',i_countb)
           iid=where(tm eq c_param+'_CIDUSTM',i_countd)
           if i_countd lt 1 then iid=where(tm eq c_param+'_DUST',i_countd)
           iias=where(tm eq c_param+'_ASSSM',i_countas)
           iics=where(tm eq c_param+'_CSSSM',i_countcs)
           iiss=where(tm eq c_param+'_SSSSM',i_countss)
           iipi=where(tm eq c_param+'_AIPOMM',i_countpi)
           iibi=where(tm eq c_param+'_AIBCM',i_countbi)

           if i_counts gt 0 or i_countb gt 0 or i_countp gt 0 or $
              i_countd gt 0 or i_countas gt 0 or $
              i_countss gt 0 or i_countcs gt 0 or i_countbi gt 0 or i_countpi gt 0 then begin	
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
             if i_countp gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iip)[*]
             if i_countb gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iib)[*]
             if i_countpi gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iipi)[*]
             if i_countbi gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iibi)[*]
             if i_countd gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iid)[*]
             if i_countcs gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iics)[*]
             if i_countss gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iiss)[*]
             if i_countas gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iias)[*]

           endif
         endif	

         if strmatch(c_var,c_param+'_PM25') then begin
           iis=where(tm eq c_param+'_ASSO4M',i_counts)
           iip=where(tm eq c_param+'_ASPOMM',i_countp)
           iib=where(tm eq c_param+'_ASBCM',i_countb)
           iipi=where(tm eq c_param+'_AIPOMM',i_countpi)
           iibi=where(tm eq c_param+'_AIBCM',i_countbi)

           if i_counts gt 0 or i_countb gt 0 or i_countp gt 0 or i_countbi gt 0 or i_countpi gt 0 then begin	
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
             if i_countp gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iip)[*]
             if i_countb gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iib)[*]
             if i_countpi gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iipi)[*]
             if i_countbi gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iibi)[*]
           endif
         endif	


         if strmatch(c_var,c_param+'_POM') then begin
           iis=where(tm eq c_param+'_AIPOMM',i_counts)
           iid=where(tm eq c_param+'_ASPOMM',i_countd)
           if i_counts gt 0 or i_countd gt 0  then begin	
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
             if i_countd gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iid)[*]
           endif
         endif	
         if strmatch(c_var,c_param+'_BC') then begin
           iis=where(tm eq c_param+'_AIBCM',i_counts)
           iid=where(tm eq c_param+'_ASBCM',i_countd)
           if i_counts gt 0 or i_countd gt 0  then begin	
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
             if i_countd gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iid)[*]
           endif
         endif	
         if strmatch(c_var,c_param+'_SS') then begin
           iia=where(tm eq c_param+'_ASSSM',i_counta)
           iic=where(tm eq c_param+'_CSSSM',i_countc)
           iis=where(tm eq c_param+'_SSSSM',i_counts)
           if i_counta gt 0 or i_countc gt 0  or i_counts gt 0 then begin	
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             if i_counta gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iia)[*]
             if i_countc gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iic)[*]
             if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
           endif
         endif	
         if strmatch(c_var,c_param+'_DUST') then begin
           iia=where(tm eq c_param+'_CIDUSTM',i_counta)					 
           if i_counta gt 0  then begin	
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             if i_counta gt 0 then tt.(i_vindex)[*]= tt.(iia)[*]
           endif
         endif	
         if strmatch(c_var,c_param+'_SO4') then begin
           iia=where(tm eq c_param+'_ASSO4M',i_counta)
           if i_counta gt 0  then begin	
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             if i_counta gt 0 then tt.(i_vindex)[*]= tt.(iia)[*]
           endif
         endif	
       endif 
       if (where( tag_names(tt) eq c_var)) ge 0 then goto,SUMMARY
; end inca specific insert

calculate WETCONC_*

IDL-code:

       if strmatch(c_var,'WETCONC_*') then begin
         iiw=where(tm eq 'WET_'+c_species,i_countw)
         iis=where(tm eq 'PRECIP_METEO',i_counts)
         if i_counts gt 0 and i_countw gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)

           tt.(i_vindex)[*]= tt.(iiw)[*]/(tt.(iis)[*]*365.)*1000. ; => ugS/l
                                ; (assuming units were mg /m2 /y and mm/d)
         endif	
       endif	

calculate mass mixing ratios from concentrations or load

IDL-code:

       if strmatch(c_var,'MMR_*') then begin
         if size(t_grid, /type) ne 8 then continue
         tn=tag_names(t_grid)
         iis=where(tm eq 'CONC3D_'+c_species,i_counts)
         iid=where(tn eq 'RHO',i_countd)
         if i_counts gt 0 and i_countd gt 0 then begin 
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iis)[*]/t_grid.(iid)[*]*1e-9
         endif else begin
           iis=where(tm eq 'LOAD3D_'+c_species,i_counts)
           iid=where(tn eq 'PDEL',i_countd)
           if i_counts gt 0 and i_countd gt 0 then begin 
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             tt.(i_vindex)[*]= tt.(iis)[*]*9.80665/t_grid.(iid)[*]
           endif
         endelse
       endif	

calculate od550aer, sconcpm10 and mmraer from the components

IDL-code

       if strmatch(c_var,'SCONC_PM10') or strmatch(c_var,'MMR_AER') or strmatch(c_var,'OD550_AER') then begin
         iiss=where(tm eq c_param+'_SS',i_countss)
         iid=where(tm eq c_param+'_DUST',i_countd)
         iis=where(tm eq c_param+'_SO4',i_counts)
         iip=where(tm eq c_param+'_POM',i_countp)
         iib=where(tm eq c_param+'_BC',i_countb)
         iin=where(tm eq c_param+'_NO3',i_countn)
         iibp=where(tm eq c_param+'_BCPOM',i_countbp)
         if i_counts gt 0 or i_countb gt 0 or i_countp gt 0 or i_countbp gt 0 or i_countss gt 0 or i_countd gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
           if i_countp gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iip)[*]
           if i_countb gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iib)[*]        
           if i_countss gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iiss)[*]
           if i_countd gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iid)[*]
           if i_countn gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iin)[*]
           if i_countbp gt 0 and i_countp lt 0 and i_countb lt 0 then $
              tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iibp)[*]
         endif
       endif	

calculate MEC550_*

       if strmatch(c_var,'MEC550_*') then begin
         iia=where(tm eq 'OD550_'+c_species,i_counta)
         iib=where(tm eq 'LOAD_'+c_species,i_countb)
         if i_counta gt 0 and i_countb gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iia)/tt.(iib)*1000.
         endif	
       endif	

calculate SWTOAAS_AER

       if strmatch(c_var,'SWTOAAS_AER') then begin
         iia=where(tm eq 'SWTOAAS_ANT',i_counta)
         iin=where(tm eq 'SWTOAAS_NAT',i_countn)
         if i_counta gt 0 and i_countn gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iin)+tt.(iia)
         endif	
       endif	

calculate SWTOACS_AER

       if strmatch(c_var,'SWTOACS_AER') then begin
         iia=where(tm eq 'SWTOACS_ANT',i_counta)
         iin=where(tm eq 'SWTOACS_NAT',i_countn)
         if i_counta gt 0 and i_countn gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iin)+tt.(iia)
         endif	
       endif	

calculate EC550*AER

       if strmatch(c_var,'EC550*AER') then begin
         iia=where(tm eq 'OD5503D_AER',i_counta)
         iih=where(tm eq 'OD5503D_AERH20',i_counth)
         iin=where(tm eq 'DH',i_countn)
         if i_counta gt 0 and i_countn gt 0  then begin	
           if strmatch(c_var,'EC550DRY_AER') then begin
             if i_counth gt 0  then begin	
               if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
               if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
               if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
               i_vindex=where( tag_names(tt) eq c_var)
               tt.(i_vindex)[*]= (tt.(iia)-tt.(iih))/tt.(iin)[*,*,i_lowlevel,*]*1.e6
             endif
           endif
           if strmatch(c_var,'EC550_AER') then begin
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             tt.(i_vindex)[*]= tt.(iia)/tt.(iin)[*,*,i_lowlevel,*]*1.e6
           endif
           if strmatch(c_var,'EC5503D_AER') then begin
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_3DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_3DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_3DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             tt.(i_vindex)[*]= tt.(iia)[*,*,*,*]/tt.(iin)[*,*,*,*]*1.e6
           endif
         endif	
       endif	

calculate CHEGPTOAQP_SO4 from components

IDL-code:

       if strmatch(c_var,'CHEGPTOAQP_SO4') then begin 
         iigp=where(tm eq 'CHEGP_SO4',i_countgp)
         iiaqp=where(tm eq 'CHEAQP_SO4',i_countqp)
         if i_countgp ge 0 and i_countaqp ge 0 then begin
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iigp)[*]/tt.(iiaqp)[*]
         endif	
       endif	

calculate ABSC550DRY3D_AER or ABSC550AETH3D_AER

       if strmatch(c_var,'ABSC550DRY3D_AER') or strmatch(c_var,'ABSC550AETH3D_AER') then begin
         iia=where(tm eq 'ABS5503D_AER',i_counta)
         iin=where(tm eq 'DH',i_countn)
         if i_counta gt 0 and i_countn gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_3DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_3DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_3DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*,*,*,*]= tt.(iia)/tt.(iin)*1.e6
         endif	
       endif	

calculate SSA_BC

       if strmatch(c_var,'SSA_BC') then begin
         iia=where(tm eq 'ABS550_BC',i_counta)
         iib=where(tm eq 'OD550_BC',i_countb)
         if i_counta gt 0 and i_countb gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= (tt.(iib)-tt.(iia))/tt.(iib)
         endif	
       endif	

calculate WETFRAC_*

IDL-code:

       if strmatch(c_var,'WETFRAC_*') then begin
         iiw=where(tm eq 'WET_'+c_species,i_countw)
         iis=where(tm eq 'DEP_'+c_species,i_counts)
         if i_counts gt 0 and i_countw gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iiw)/tt.(iis)*100.
         endif	
       endif	

Calculate ang4487aer and ang4487csaer from the components

IDL-code:

       if strmatch(c_var,'ANG4487_*') then begin
         iis55=where(tm eq 'OD550_'+c_species,i_counts55)
         iis44=where(tm eq 'OD440_'+c_species,i_counts44)
         iis82=where(tm eq 'OD825_'+c_species,i_counts82)
         iis86=where(tm eq 'OD865_'+c_species,i_counts86)
         iis87=where(tm eq 'OD870_'+c_species,i_counts87)
         if ( i_counts55 gt 0 or i_counts44 gt 0 ) and ( i_counts86 gt 0 or i_counts87 gt 0 or i_counts82 gt 0 ) then begin 
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           
           if	i_counts44 gt 0  then begin
             wavela=440. 
             iis=iis44		
           endif else if i_counts55 gt 0 then begin
             wavela=550. 
             iis=iis55
           endif else wavela=-1.

           if	i_counts86 gt 0  then begin
             wavelb=865. 
             iid=iis86		
           endif else if i_counts87 gt 0 then begin
             wavelb=870. 
             iid=iis87
           endif else if i_counts82 gt 0 then begin
             wavelb=825. 
             iid=iis82
           endif else wavelb=-1.

           ratio=wavela/wavelb
           if ratio gt 0 then $
              tt.(i_vindex)[*]= -1.0*alog(tt.(iis)[*]/tt.(iid)[*])/(alog(ratio))
         endif
       endif	

calculate ABS550_*

       if strmatch(c_var,'ABS550_'+c_species) then begin
         iia=where(tm eq 'OD550_'+c_species,i_counta)
         iib=where(tm eq 'SSA_'+c_species,i_countb)
         if i_counta gt 0 and i_countb gt 0 then begin
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           if mean(tt.(iib)) gt 0.01 then begin
             tt.(i_vindex)[*]= (1.-tt.(iib))*tt.(iia) ;; SSA is known from model
           endif else tt.(i_vindex)[*]=	!VALUES.F_NAN
         endif else begin
           iia=where(tm eq 'ABS550_BC',i_counta)
           iid=where(tm eq 'ABS550_DUST',i_countd)
           iip=where(tm eq 'ABS550_POM',i_countp)
           if i_counta gt 0 and i_countd gt 0 then begin
             if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
             if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
             if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
             i_vindex=where( tag_names(tt) eq c_var)
             tt.(i_vindex)[*]= tt.(iia)+tt.(iid) 
             if i_countp gt 0 then tt.(i_vindex)[*]=tt.(i_vindex)[*]+tt.(iip)
           endif  
         endelse		
       endif	

calculate ABSC550DRY_AER or ABSC550AETH_AER

       if strmatch(c_var,'ABSC550DRY_AER') or strmatch(c_var,'ABSC550AETH_AER') then begin
         iic=where(tm eq 'ABSC550DRY3D_AER',i_countc)
         iia=where(tm eq 'ABS5503D_AER',i_counta)
         iin=where(tm eq 'DH',i_countn)
         if ( i_counta gt 0 and i_countn gt 0 ) or i_countc gt 0 then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           if i_countc gt 0 then begin	
             tt.(i_vindex)[*,*,*]= tt.(iic)[*,*,i_lowlevel,*]
           endif else $	
              tt.(i_vindex)[*,*,*]= tt.(iia)[*,*,i_lowlevel,*]/tt.(iin)[*,*,i_lowlevel,*]*1.e6
         endif	
       endif	
``

calculate LIFETIME_*

       if strmatch(c_var,'LIFETIME_*') then begin
         iiw=where(tm eq 'LOAD_'+c_species,i_countw)
         iis=where(tm eq 'DEP_'+c_species,i_counts)
         if i_counts gt 0 and i_countw gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iiw)/tt.(iis)/1000.*365. ; mg m-2 / g m-2 y-1 * (d y-1) 
         endif	
       endif	

calculate SWTOAAS_ANT

       if strmatch(c_var,'SWTOAAS_ANT') or strmatch(c_var,'SWTOACS_ANT') then begin
         iia=where(tm eq c_param+'_BBANT',i_counta)
         iib=where(tm eq c_param+'_SOAANT',i_countb)
         iic=where(tm eq c_param+'_OAFFANT',i_countc)
         iid=where(tm eq c_param+'_BCFFANT',i_countd)
         iie=where(tm eq c_param+'_SO4ANT',i_counte)
         iif=where(tm eq c_param+'_NO3ANT',i_countf)

         if i_counta gt 0 or i_countb gt 0 or  i_countc gt 0 or i_countd gt 0 or  i_counte gt 0 or i_countf gt 0   then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           if i_counta gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iia)[*]
           if i_countb gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iib)[*]
           if i_countc gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iic)[*]
           if i_countd gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iid)[*]
           if i_counte gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iie)[*]
           if i_countf gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iif)[*]
         endif	
       endif	

calculate 'RFEAS_*

       if strmatch(c_var,'RFEAS_*') then begin
         iiw=where(tm eq 'SWTOAAS_'+c_species,i_countw)
         iis=where(tm eq 'LOAD_'+c_species,i_counts)
         if i_counts gt 0 and i_countw gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iiw)/tt.(iis)*1000.
         endif	
       endif	

calculate MABS550_BC

       if strmatch(c_var,'MABS550_BC') then begin
         iia=where(tm eq 'ABS550_BC',i_counta)
         iib=where(tm eq 'LOAD_BC',i_countb)
         if i_counta gt 0 and i_countb gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iia)/tt.(iib)*1000.
         endif	
       endif	

calculate RFEODCS_*

idl-code:

       if strmatch(c_var,'RFEODCS_*') then begin
         iiw=where(tm eq 'SWTOACS_'+c_species,i_countw)
         iis=where(tm eq 'OD550_'+c_species,i_counts)
         if i_counts gt 0 and i_countw gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iiw)/tt.(iis)
         endif	
       endif	

calculate RFECS_*

       if strmatch(c_var,'RFECS_*') then begin
         iiw=where(tm eq 'SWTOACS_'+c_species,i_countw)
         iis=where(tm eq 'LOAD_'+c_species,i_counts)
         if i_counts gt 0 and i_countw gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iiw)/tt.(iis)*1000.
         endif	
       endif	

calculate deposition

IDL-code:

       if strmatch(c_var,'DEP_*') then begin
         iiw=where(tm eq 'WET_'+c_species,i_countw)
         iis=where(tm eq 'SED_'+c_species,i_counts)
         iid=where(tm eq 'DRY_'+c_species,i_countd)
         iisd=where(tm eq 'SEDDRY_'+c_species,i_countsd)
         if i_counts gt 0 or i_countd gt 0 or i_countw gt 0 or i_countsd gt 0 then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)

           if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
           if i_countd gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iid)[*]
           if i_countw gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iiw)[*]
           if i_countsd gt 0 and iis lt 0 and iid lt 0 then $
              tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iisd)[*]
         endif	
       endif	

calculate od550gt1aer from the comonents

IDL-code:

       if strmatch(c_var,'OD550GT1_*') then begin
         if strmatch(c_var,'OD550GT1_AER') then c_paramm='OD550' else c_paramm=c_param
         iis=where(tm eq c_paramm+'_SS',i_counts)
         iid=where(tm eq c_paramm+'_DUST',i_countd)
         if i_counts gt 0 or i_countd gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
           if i_countd gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iid)[*]
         endif
       endif	

calculate od550lt1aer and sconpm25 from the components

IDL-code:

         if strmatch(c_var,'OD550LT1_AER') then c_paramm='OD550' else c_paramm=c_param
         iis=where(tm eq c_paramm+'_SO4',i_counts)
         iip=where(tm eq c_paramm+'_POM',i_countp)
         iib=where(tm eq c_paramm+'_BC',i_countb)
         iibp=where(tm eq c_paramm+'_BCPOM',i_countbp)

         if i_counts gt 0 or i_countb gt 0 or i_countp gt 0 or i_countbp gt 0 then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           if i_counts gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iis)[*]
           if i_countp gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iip)[*]
           if i_countb gt 0 then tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iib)[*]
           if i_countbp gt 0 and i_countp lt 0 and i_countb lt 0 then $
              tt.(i_vindex)[*]= tt.(i_vindex)[*]+tt.(iibp)[*]
         endif
       endif

calculate RFEODAS_*

idl code

       if strmatch(c_var,'RFEODAS_*') then begin
         iiw=where(tm eq 'SWTOAAS_'+c_species,i_countw)
         iis=where(tm eq 'OD550_'+c_species,i_counts)
         if i_counts gt 0 and i_countw gt 0  then begin	
           if i_datatype eq 0 then tt=create_struct(tt,c_Var, fltarr(i_2DMVardims))
           if i_datatype eq 1 then tt=create_struct(tt,c_Var, fltarr(i_2DDVardims))
           if i_datatype eq 2 then tt=create_struct(tt,c_Var, fltarr(i_2DHVardims))
           i_vindex=where( tag_names(tt) eq c_var)
           tt.(i_vindex)[*]= tt.(iiw)/tt.(iis)
         endif	
       endif	

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.