pro convert_species,filename,dtype,spec,spnum ; Program update to convert_spec124 that will work with the 119 species mechanism. ; It reads in species_dim from filename to determine 124 or 119. And will read in the const_labels for amonthly files, ; the only file with output for all species. ; Full 124 species are only available in the monthly average files (dtype='amonthly') and ; rst (restart) files. ; 12 species are available in 'idaily' and 6 species are available in 'overpass1'. ; idaily species are determined by reading in freq1_labels because different simulations save different ; sets of species. ; 1 species available in hourly and column (ozone). ; specdim=read_mech(filename,dtype,constlabels) constlabels=strupcase(constlabels) ; Rename commonly used names for CFCs: F11, F12 spec=strupcase(spec) if spec eq 'F11' then spec='CFCL3' if spec eq 'F12' then spec='CF2CL2' ; remember, idl numbering 0-123, netcdf numbering 1-124. if dtype eq 'amonthly' or dtype eq 'rst' then begin x=where(constlabels eq spec) if x(0) ge 0 then spnum=x(0)+1 if x(0) lt 0 then spnum=0 endif ; ----------------------------------------------------------------------------- if dtype eq 'idaily' then begin ; Need to read in the species labels in idaily file because they change sometimes ; Open first element of cfile array. cdfid=ncdf_open(filename) var='freq1_labels' varid=ncdf_varid(cdfid,var) ncdf_varget,cdfid,varid,result result=string(result) fullspec=strtrim(result,2) fullspec=strupcase(fullspec) ; Add PV and temp to the full spec array! fullspec=[fullspec,'PV','TEMP'] ncdf_close,cdfid x=where(fullspec eq spec) if x(0) ge 0 then spnum=x(0)+1 if x(0) lt 0 then spnum=0 endif ; --------------------------------------------------------------------------------- if dtype eq 'overpass1' or dtype eq 'overpass2' or dtype eq 'overpass3' or dtype eq 'overpass4' then begin fullspec=['CH2O','CO','NO','NO2','O3','OH','TEMP'] x=where(fullspec eq spec) if x(0) ge 0 then spnum=x(0)+1 if x(0) lt 0 then spnum=0 endif if dtype eq 'hourlyoz' then spnum=1 if dtype eq 'column' then begin ; special names for species saved as tropospheric columns fullspec=['TCH2O','TNO2','TO3','CH2O','NO2','O3'] x=where(fullspec eq spec) if x(0) ge 0 then spnum=x(0)+1 if x(0) lt 0 then spnum=0 endif end