function read_mech,filename,dtype,constlabels ; Open file and read in the number of species in the const array. This is now necessary because ; there is the original 124 species mechanism and the new 119. Species_dim is needed to obtain ; the correct 'spnum'. ; ; Also return the (string) labels of all constituents ; ; 'spnum' is species number (for const variable). ; ; 'var' is a string for the variable type (e.g., 'kel', 'const') ; 'rec' is the time record (integer). ncdump -h filename will tell you how ; many records are in the file. ; 'idim, jdim, and kdim' are dimensions of lon, lat, and levels. ; run @get_combo_spec to get species number. ; ; Need separate reading statements because of the different names used for species labels in different ; output file types. (arghh!) ; cdfid=ncdf_open(filename) if dtype eq 'amonthly' then speciesid=ncdf_varid(cdfid,'species_dim') if dtype eq 'idaily' then speciesid=ncdf_varid(cdfid,'freq1_species') if dtype eq 'overpass1' then speciesid=ncdf_varid(cdfid,'species_overpass') if dtype eq 'overpass2' then speciesid=ncdf_varid(cdfid,'species_overpass') if dtype eq 'column' then speciesid=ncdf_varid(cdfid,'freq3_species') ncdf_varget,cdfid,speciesid,specdim specdim=n_elements(specdim) if dtype eq 'amonthly' then speciesid=ncdf_varid(cdfid,'const_labels') if dtype eq 'idaily' then speciesid=ncdf_varid(cdfid,'freq1_labels') if dtype eq 'overpass1' then speciesid=ncdf_varid(cdfid,'overpass_labels') if dtype eq 'overpass2' then speciesid=ncdf_varid(cdfid,'overpass_labels') if dtype eq 'column' then speciesid=ncdf_varid(cdfid,'freq3_labels') ncdf_varget,cdfid,speciesid,constlabels constlabels=strtrim(constlabels,2) ncdf_close,cdfid return, specdim end