; The procedure HRMET returns a matrix of pressure and a matrix of ; water vapor mixing ratio with values corresponding to each half hour of ; the days selected for processing in dayflux_wc.pro. ; The data to do this is obtained from the WCYYQMIX files where YY = year. ; The primary use for this routine is for calculating real flux units ; in the program dayflux_wc.pro (and hrflux_wc.pro). ;*************************************************************************** ;Use is as follows: ; hrmet_wc,startyy,startjday,days,airp,qmix ;Where ; Input ; startyy = string of 2-digit year ; startjday = integer of starting Julian day ; days = string of number of days to be processed ; ; Output ; airp = pressure (mb) Note: Value stored in qmix file is in kPa, ; thus it is multiplied by 10 to give mb=hPa. ; qmix = water vapor mixing ratio (g/kg) ; ; Written by BWBerger 12/11/98 ; Modified for WCreek by Dana Carrington March 1999 ;*************************************************************************** pro hrmet_lc_psu,startyy,startjday,days,airp,qmix numdays=fix(days) badval=-999. ; Load file containing slow data for pressure and mixing ratio ;cmd = "load,'/data/davis2/wcreek/qmix/wc"+startyy+"qmix',wc" ; cmd = "load,'/davis/s1/cheas/wcreek/qmix/wc"+startyy+"qmix',wc" ; changed by wwg on Sep 19, 2000, use !hrmet to replace ; /davis/s1/cheas/wcreek/qmix/wc filename='' ; filename= !HRMET + startyy+'qmix' ;modified by wwg, Dec, 17,00, change !hrmet to detailed directory ; filename= '/davis/s1/cheas/lcreek/qmix/lc'+startyy+'qmix' ; filename= '/davis/s2/lcreek/qmix/lc'+startyy+'qmix' ;change davis/s2 to eddy/s4 filename= '/eddy/s4/lcreek/qmix/lc'+startyy+'qmix' cmd="load,filename,wc" r = execute(cmd) ;initialize full temporary array with badvals in place of data. n=48*numdays ;the number of rows in a full output array halfhr=[[0],[30],[100],[130],[200],[230],[300],[330],[400],[430],[500],[530],[600],[630],[700],[730],[800],[830],[900],[930],[1000],[1030],[1100],[1130],[1200],[1230],[1300],[1330],[1400],[1430],[1500],[1530],[1600],[1630],[1700],[1730],[1800],[1830],[1900],[1930],[2000],[2030],[2100],[2130],[2200],[2230],[2300],[2330]] fullarray=fltarr(4,n)-999. for i=0,numdays-1 do begin for j=0,48-1 do begin fullarray(0,i*48+j)=startjday+i fullarray(1,i*48+j)=halfhr(j) endfor endfor ;Load-up an array with all available data for dates chosen. ;This array may have gaps. temparray=fltarr(4,n+100)-999. ;initialize count = 0 for i = 0, len(wc) - 1 do begin if (wc(0,i) ge startjday) and (wc(0,i) le startjday+numdays-1) then begin temparray(0,count)=wc(0,i) ;julian day temparray(1,count)=wc(1,i) ;half hour if(wc(2,i) ne -999.) then temparray(2,count) = wc(2,i) * 10.;airp ;(fixed by wwg Jan 11,2000) temparray(3,count) = wc(3,i) ;qmix count = count + 1 endif endfor if count eq 0 then begin ;no data available for selected dates print,'hrmet could find no data in qmix file for the selected dates.' print,'Output returned as badvals.' printf,8,'hrmet could find no data in qmix file for the selected dates.' printf,8,'Output returned as badvals.' airp=fltarr(1,n)-999. qmix=fltarr(1,n)-999. endif else begin ;trim temparray and place its data in the correct position ;in the fullarray m=count-1 ;m=(the number of filled rows in temparray)-1 if (m+1.)/48.-round((m+1.)/48.) ne 0. then begin print,'qmix has redundant entry, hrmet output returned as badvals.' printf,8,'qmix has redundant entry, hrmet output returned as badvals.' airp=fltarr(1,n)-999. qmix=fltarr(1,n)-999. goto,fini endif temparray=temparray(*,0:m) ;trimming j=0 for i=0,n-1 do begin ;placing data in fullarray if j le m then begin if temparray(0,j) eq fullarray(0,i) and temparray(1,j) eq fullarray(1,i) then begin fullarray(*,i)=temparray(*,j) j=j+1 endif endif endfor airp=fullarray(2,*) qmix=fullarray(3,*) endelse fini: return end