function read_nc_3d,filename,rec,idim,jdim,kdim,var,spnum=spnum ; Modified 11/23/05 to accomodate 'const_freq2' as a const name for the ; high frequency combo output. ; '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. ; cdfid=ncdf_open(filename) species=fltarr(idim,jdim,kdim) speciesid=ncdf_varid(cdfid,var) ; There are two type of 3D fields that can be read in. One type has more than ; one species (e.g. const or qj), the other has only one species (e.g. kel). ; We must identify which case we have, then make the right varget call. ; As the number of different variable types read in increases, modify the ; line below to include new variables that have n species in them. ; If var is some type of const, check is by looking at the first 5 char of ; var. varfrag=strmid(var,0,5) kase=2 if varfrag eq 'const' or var eq 'qqk' or var eq 'qqj' or var eq 'qj' or $ var eq 'qk' then kase=1 ; Need an exception for the case (in tracer suite) where const does not have multiple species if varfrag eq 'const' and keyword_set(spnum) eq 0 then kase=2 if kase eq 1 then $ ncdf_varget,cdfid,speciesid,species,count=[idim,jdim,kdim,1,1],offset=[0,0,0,spnum-1,rec-1] ; if kase eq 2 then $ ncdf_varget,cdfid,speciesid,species,count=[idim,jdim,kdim,1],offset=[0,0,0,rec-1] ; ncdf_close,cdfid return,species end