; ; Read in the molts data ; pro get_molts_data,site,searchdate ; ; common containing the data ; common molts_data, pres,temp,u_wind,v_wind,humid,omega,cloud_h2o_mix,$ conv_lat_heat,stab_lat_heat,sw_heat,lw_heat,cloud_fract,turb_kin,$ ice_mix,numtimes,base_time,time_offset,numheights,newheight,files ; ; Site and date to be analyzed ; site=strcompress(string(site),/remove_all) searchdate=strcompress(string(searchdate),/remove_all) searchyear=fix(strmid(searchdate,0,4)) searchmonth=fix(strmid(searchdate,4,2)) ; ; Find the netcdf files ; if site eq 'sgp' then begin armdatadir='/data/mace3/arm_data/sgp/' datastream='sgpmoltsedassndclass1X1.a1/' armfile='sgpmoltsedassndclass1X1.a1.'+searchdate+ '*.cd*' endif else if site eq 'nsa' then begin armdatadir='/data/mace2/arm_data/nsa/' datastream='nsamoltsedassndclass1X1.a1/' armfile='nsamoltsedassndclass1X1.a1.'+searchdate+ '*.cd*' endif else if site eq 'twpc1' then begin armdatadir='/data/mace/arm_data/twp/Manus_C1/' datastream='twpc1moltsedassndclass1X1.a1/' armfile='twpc1moltsedassndclass1X1.a1.'+searchdate+ '*.cd*' endif else if site eq 'twpc2' then begin armdatadir='/data/mace/arm_data/twp/Nauru_C2/' datastream='twpc2moltsedassndclass1X1.a1/' armfile='twpc2moltsedassndclass1X1.a1.'+searchdate+ '*.cd*' endif armfile=armdatadir+datastream+armfile ; ; Unzip the netcdf files ; spawn,'gunzip -fq ' + armfile ; ; Get a list of the files ; files=findfile(armfile,count=num_files) print, 'Found ',num_files,' files' ; ; Loop through all the matching files in the directory ; j=-1 ;counts number of files containing the variable for i=0,num_files-1 do begin ; ; Don't try to process any gif files that may be in the directory ; if strpos(files[i],'gif') eq -1 and $ strpos(files[i],'png') eq -1 then begin j=j+1 print,i,j,files[i] ; ; Open the netcdf file ; cdfid=ncdf_open(files[i]) ; ; Get the dimension id's ; level_did=ncdf_dimid(cdfid,'level') time_did=ncdf_dimid(cdfid,'time') station_did=ncdf_dimid(cdfid,'station') ; ; Get the dimensions ; Make sure that number of levels is the same as in the previous file ; if level_did ge 0 then ncdf_diminq,cdfid,level_did,charstring,tempnumlevels if j eq 0 then numlevels=tempnumlevels $ else begin if numlevels eq tempnumlevels then print, 'same number of levels' if numlevels ne tempnumlevels then begin ncdf_close,cdfid goto, skip_this_file endif endelse if time_did ge 0 then ncdf_diminq,cdfid,time_did,charstring,numtimes if station_did ge 0 then ncdf_diminq,cdfid,station_did,charstring,$ numstations ; ; Get the variable id's ; base_time_id=ncdf_varid(cdfid,'base_time') time_offset_id=ncdf_varid(cdfid,'time_offsets') lat_stn_id=ncdf_varid(cdfid,'lat_stn') lon_stn_id=ncdf_varid(cdfid,'lon_stn') alt_stn_id=ncdf_varid(cdfid,'alt_stn') num_stn_id=ncdf_varid(cdfid,'num_stn') pres_id=ncdf_varid(cdfid,'pres') temp_id=ncdf_varid(cdfid,'temp') u_wind_id=ncdf_varid(cdfid,'u_wind') ;for 2000 if u_wind_id eq -1 then u_wind_id=ncdf_varid(cdfid,'wdir') ;for 1999 v_wind_id=ncdf_varid(cdfid,'v_wind') ;for 2000 if v_wind_id eq -1 then v_wind_id=ncdf_varid(cdfid,'wspd') ;for 1999 humid_id=ncdf_varid(cdfid,'humid') omega_id=ncdf_varid(cdfid,'omega') cloud_h2o_mix_id=ncdf_varid(cdfid,'cloud_h2o_mix') conv_lat_heat_id=ncdf_varid(cdfid,'conv_lat_heat') stab_lat_heat_id=ncdf_varid(cdfid,'stab_lat_heat') sw_heat_id=ncdf_varid(cdfid,'sw_heat') lw_heat_id=ncdf_varid(cdfid,'lw_heat') cloud_fract_id=ncdf_varid(cdfid,'cloud_fract') turb_kin_id=ncdf_varid(cdfid,'turb_kin') ice_mix_id=ncdf_varid(cdfid,'ice_mix') ;for 2000 ; ; Get the variables ; if base_time_id ne -1 then ncdf_varget,cdfid,base_time_id,base_time if time_offset_id ne -1 then ncdf_varget,cdfid,time_offset_id,time_offset if lat_stn_id ne -1 then ncdf_varget,cdfid,lat_stn_id,lat_stn if lon_stn_id ne -1 then ncdf_varget,cdfid,lon_stn_id,lon_stn if alt_stn_id ne -1 then ncdf_varget,cdfid,alt_stn_id,alt_stn if num_stn_id ne -1 then ncdf_varget,cdfid,num_stn_id,num_stn if pres_id ne -1 then ncdf_varget,cdfid,pres_id,pres if temp_id ne -1 then ncdf_varget,cdfid,temp_id,temp if u_wind_id ne -1 then ncdf_varget,cdfid,u_wind_id,u_wind if v_wind_id ne -1 then ncdf_varget,cdfid,v_wind_id,v_wind if humid_id ne -1 then ncdf_varget,cdfid,humid_id,humid if omega_id ne -1 then ncdf_varget,cdfid,omega_id,omega if cloud_h2o_mix_id ne -1 then ncdf_varget,cdfid,cloud_h2o_mix_id,$ cloud_h2o_mix if conv_lat_heat_id ne -1 then ncdf_varget,cdfid,conv_lat_heat_id,$ conv_lat_heat if stab_lat_heat_id ne -1 then ncdf_varget,cdfid,stab_lat_heat_id,$ stab_lat_heat if sw_heat_id ne -1 then ncdf_varget,cdfid,sw_heat_id,sw_heat if lw_heat_id ne -1 then ncdf_varget,cdfid,lw_heat_id,lw_heat if cloud_fract_id ne -1 then ncdf_varget,cdfid,cloud_fract_id,cloud_fract if turb_kin_id ne -1 then ncdf_varget,cdfid,turb_kin_id,turb_kin if ice_mix_id ne -1 then ncdf_varget,cdfid,ice_mix_id,ice_mix ; ; Close the netcdf file ; ncdf_close,cdfid ; ; Determine the closest station to the site using the distance formula ; if site eq 'nsa' then begin lat_site=71.323 lon_site=-156.609 endif else if site eq 'sgp' then begin lat_site=36.606 lon_site=-97.485 endif distance=sqrt((lat_site-lat_stn)^2+(lon_site-lon_stn)^2) closest=min(distance,station_ind) ; ; Convert pressure from pa to mb ; result=where(pres ne -99999,count) if count ne 0 then pres[result]=pres[result]/100.;convert from pa to mb ; ; Select the arrays for our station id ; nsa_pres=pres[station_ind,*,*] nsa_pres=reform(nsa_pres) nsa_temp=temp[station_ind,*,*] nsa_temp=reform(nsa_temp) if u_wind_id ne -1 then begin nsa_u_wind=u_wind[station_ind,*,*] nsa_u_wind=reform(nsa_u_wind) endif if v_wind_id ne -1 then begin nsa_v_wind=v_wind[station_ind,*,*] nsa_v_wind=reform(nsa_v_wind) endif nsa_humid=humid[station_ind,*,*] nsa_humid=reform(nsa_humid) nsa_omega=omega[station_ind,*,*] nsa_omega=reform(nsa_omega) nsa_cloud_h2o_mix=cloud_h2o_mix[station_ind,*,*] nsa_cloud_h2o_mix=reform(nsa_cloud_h2o_mix) nsa_conv_lat_heat=conv_lat_heat[station_ind,*,*] nsa_conv_lat_heat=reform(nsa_conv_lat_heat) nsa_stab_lat_heat=stab_lat_heat[station_ind,*,*] nsa_stab_lat_heat=reform(nsa_stab_lat_heat) nsa_sw_heat=sw_heat[station_ind,*,*] nsa_sw_heat=reform(nsa_sw_heat) nsa_lw_heat=lw_heat[station_ind,*,*] nsa_lw_heat=reform(nsa_lw_heat) nsa_cloud_fract=cloud_fract[station_ind,*,*] nsa_cloud_fract=reform(nsa_cloud_fract) nsa_turb_kin=turb_kin[station_ind,*,*] nsa_turb_kin=reform(nsa_turb_kin) if ice_mix_id ne -1 then begin nsa_ice_mix=ice_mix[station_ind,*,*] nsa_ice_mix=reform(nsa_ice_mix) endif ; ; If it is the first file ; if j eq 0 then begin numlevels0=numlevels com_btto=long(base_time)+long(time_offset) com_nsa_pres=nsa_pres com_nsa_temp=nsa_temp if u_wind_id ne -1 then com_nsa_u_wind=nsa_u_wind if v_wind_id ne -1 then com_nsa_v_wind=nsa_v_wind com_nsa_humid=nsa_humid com_nsa_omega=nsa_omega com_nsa_cloud_h2o_mix=nsa_cloud_h2o_mix com_nsa_conv_lat_heat=nsa_conv_lat_heat com_nsa_stab_lat_heat=nsa_stab_lat_heat com_nsa_sw_heat=nsa_sw_heat com_nsa_lw_heat=nsa_lw_heat com_nsa_cloud_fract=nsa_cloud_fract com_nsa_turb_kin=nsa_turb_kin if ice_mix_id ne -1 then com_nsa_ice_mix=nsa_ice_mix endif else begin ; ; If it is now the first file ; com_btto=[long(com_btto),long(base_time)+long(time_offset)] com_nsa_pres=[com_nsa_pres,nsa_pres] com_nsa_temp=[com_nsa_temp,nsa_temp] if u_wind_id ne -1 then com_nsa_u_wind=[com_nsa_u_wind,nsa_u_wind] if v_wind_id ne -1 then com_nsa_v_wind=[com_nsa_v_wind,nsa_v_wind] com_nsa_humid=[com_nsa_humid,nsa_humid] com_nsa_omega=[com_nsa_omega,nsa_omega] com_nsa_cloud_h2o_mix=[com_nsa_cloud_h2o_mix,nsa_cloud_h2o_mix] com_nsa_conv_lat_heat=[com_nsa_conv_lat_heat,nsa_conv_lat_heat] com_nsa_stab_lat_heat=[com_nsa_stab_lat_heat,nsa_stab_lat_heat] com_nsa_sw_heat=[com_nsa_sw_heat,nsa_sw_heat] com_nsa_lw_heat=[com_nsa_lw_heat,nsa_lw_heat] com_nsa_cloud_fract=[com_nsa_cloud_fract,nsa_cloud_fract] com_nsa_turb_kin=[com_nsa_turb_kin,nsa_turb_kin] if ice_mix_id ne -1 then com_nsa_ice_mix=[com_nsa_ice_mix,nsa_ice_mix] endelse skip_this_file: endif ;end of not a gif file endfor ;end of loop through matching files ; ; Redefine arrays ; nsa_pres=com_nsa_pres nsa_temp=com_nsa_temp if u_wind_id ne -1 then nsa_u_wind=com_nsa_u_wind if v_wind_id ne -1 then nsa_v_wind=com_nsa_v_wind nsa_humid=com_nsa_humid nsa_omega=com_nsa_omega nsa_cloud_h2o_mix=com_nsa_cloud_h2o_mix nsa_conv_lat_heat=com_nsa_conv_lat_heat nsa_stab_lat_heat=com_nsa_stab_lat_heat nsa_sw_heat=com_nsa_sw_heat nsa_lw_heat=com_nsa_lw_heat nsa_cloud_fract=com_nsa_cloud_fract nsa_turb_kin=com_nsa_turb_kin if ice_mix_id ne -1 then nsa_ice_mix=com_nsa_ice_mix ; ; Get parameters of new arrays ; base_time=long(com_btto[0]) ;base time time_offset=long(com_btto)-long(base_time) numtimes=n_elements(time_offset) ; ; Determine how many -99999.0 levels to cut from the arrays ; result=where(nsa_pres[0,*] eq -99999.0,count) ;determine which levels are -99999 if result[0] eq numlevels-1 then begin ;if the last level is -99999, then cut the array shorter print,'last level eq -99999' cutvalue=numlevels-2 cutarray='yes' endif else if result[0] eq -1 then begin print,'All the levels are good' cutarray='no' endif else if count eq 3 and result[2] eq numlevels-1 then begin print,'The last 3 levels are -99999' cutvalue=numlevels-4 cutarray='yes' endif else if count eq 4 and result[3] eq numlevels-1 then begin print,'The last 4 levels are -99999' cutvalue=numlevels-5 cutarray='yes' endif else if count eq 5 and result[4] eq numlevels-1 then begin print,'The last 5 levels are -99999' cutvalue=numlevels-6 cutarray='yes' endif else if count eq 10 and result[9] eq numlevels-1 then begin print,'The last 10 levels are -99999' cutvalue=numlevels-11 cutarray='yes' endif else begin print, 'the last level is not the only -9999 level' stop endelse ; ; Cut the -99999.0 levels out of the arrays ; if cutarray eq 'yes' then begin ;if cutvalue eq numlevels-6 then stop nsa_pres=nsa_pres[*,0:cutvalue] nsa_temp=nsa_temp[*,0:cutvalue] if u_wind_id ne -1 then nsa_u_wind=nsa_u_wind[*,0:cutvalue] if v_wind_id ne -1 then nsa_v_wind=nsa_v_wind[*,0:cutvalue] nsa_humid=nsa_humid[*,0:cutvalue] nsa_omega=nsa_omega[*,0:cutvalue] nsa_cloud_h2o_mix=nsa_cloud_h2o_mix[*,0:cutvalue] nsa_conv_lat_heat=nsa_conv_lat_heat[*,0:cutvalue] nsa_stab_lat_heat=nsa_stab_lat_heat[*,0:cutvalue] nsa_sw_heat=nsa_sw_heat[*,0:cutvalue] nsa_lw_heat=nsa_lw_heat[*,0:cutvalue] nsa_cloud_fract=nsa_cloud_fract[*,0:cutvalue] nsa_turb_kin=nsa_turb_kin[*,0:cutvalue] if ice_mix_id ne -1 then nsa_ice_mix=nsa_ice_mix[*,0:cutvalue] ;if cutvalue eq numlevels-6 then stop endif ; ; Calculate height from pressure ; pressure=nsa_pres[0,*] To=288 ;Kelvins Po=1013.25 ;mb G=6.50 ;deg km-1 G=G/1000. ;deg m-1 grav=9.81 ;m/s R=287 ;J/deg/kg exponent=R*G/grav bracket=1-(pressure/Po)^exponent height=To/G*bracket height=height/1000. ;convert to km ; ; Create new regular height grid ; if site eq 'nsa' then numheights=61 else numheights=75 newheight=findgen(numheights)*0.25 ; ; Interpolate 2D grids to newheights grid ; pres=fltarr(numtimes,numheights) temp=fltarr(numtimes,numheights) if u_wind_id ne -1 then u_wind=fltarr(numtimes,numheights) if v_wind_id ne -1 then v_wind=fltarr(numtimes,numheights) humid=fltarr(numtimes,numheights) omega=fltarr(numtimes,numheights) cloud_h2o_mix=fltarr(numtimes,numheights) conv_lat_heat=fltarr(numtimes,numheights) stab_lat_heat=fltarr(numtimes,numheights) sw_heat=fltarr(numtimes,numheights) lw_heat=fltarr(numtimes,numheights) cloud_fract=fltarr(numtimes,numheights) turb_kin=fltarr(numtimes,numheights) if ice_mix_id ne -1 then ice_mix=fltarr(numtimes,numheights) for t=0,numtimes-1 do begin pres[t,*]=interpol(nsa_pres[t,*],height,newheight) temp[t,*]=interpol(nsa_temp[t,*],height,newheight) if u_wind_id ne -1 then $ u_wind[t,*]=interpol(nsa_u_wind[t,*],height,newheight) if v_wind_id ne -1 then $ v_wind[t,*]=interpol(nsa_v_wind[t,*],height,newheight) humid[t,*]=interpol(nsa_humid[t,*],height,newheight) omega[t,*]=interpol(nsa_omega[t,*],height,newheight) cloud_h2o_mix[t,*]=interpol(nsa_cloud_h2o_mix[t,*],height,newheight) conv_lat_heat[t,*]=interpol(nsa_conv_lat_heat[t,*],height,newheight) stab_lat_heat[t,*]=interpol(nsa_stab_lat_heat[t,*],height,newheight) sw_heat[t,*]=interpol(nsa_sw_heat[t,*],height,newheight) lw_heat[t,*]=interpol(nsa_lw_heat[t,*],height,newheight) cloud_fract[t,*]=interpol(nsa_cloud_fract[t,*],height,newheight) turb_kin[t,*]=interpol(nsa_turb_kin[t,*],height,newheight) if ice_mix_id ne -1 then $ ice_mix[t,*]=interpol(nsa_ice_mix[t,*],height,newheight) endfor ; ; Get rid of negative values that are accidently interpolated in ; result=where(cloud_h2o_mix lt 0,count) if count ne 0 then cloud_h2o_mix[result]=0 if ice_mix_id ne -1 then begin result=where(ice_mix lt 0,count) if count ne 0 then ice_mix[result]=0 endif result=where(cloud_fract lt 0,count) if count ne 0 then cloud_fract[result]=0 result=where(cloud_fract gt 100, count) if count ne 0 then cloud_fract[result]=100 result=where(humid lt 0,count) if count ne 0 then humid[result]=0 ;******************************************************************** ; Fill in time gaps with blanks so the data will plot correctly ;******************************************************************* ; ; Create temporary arrays to hold the filled in data ; tempto=make_array(numtimes+1000,/long,value=-9999) temp_pres=fltarr(numtimes+1000,numheights) temp_temp=fltarr(numtimes+1000,numheights) if u_wind_id ne -1 then temp_u_wind=fltarr(numtimes+1000,numheights) if v_wind_id ne -1 then temp_v_wind=fltarr(numtimes+1000,numheights) temp_humid=fltarr(numtimes+1000,numheights) temp_omega=fltarr(numtimes+1000,numheights) temp_cloud_h2o_mix=fltarr(numtimes+1000,numheights) temp_conv_lat_heat=fltarr(numtimes+1000,numheights) temp_stab_lat_heat=fltarr(numtimes+1000,numheights) temp_sw_heat=fltarr(numtimes+1000,numheights) temp_lw_heat=fltarr(numtimes+1000,numheights) temp_cloud_fract=fltarr(numtimes+1000,numheights) temp_turb_kin=fltarr(numtimes+1000,numheights) if ice_mix_id ne -1 then temp_ice_mix=fltarr(numtimes+1000,numheights) printtt=0 ;flag for printing some output to the screen tt=0 ;index for the filled in data ; ; Calculate the first time value ; start_base_time=num_sec_ep(searchyear,searchmonth,1,0,0,0) ; ; Determine if it is a leap year ; leap_flag=0 check4=(searchyear) mod 4 ;years divisible by 4 are leap years, unless..... check100=(searchyear) mod 100 ;years also divisible by 100 are not leap years, except..... check400=(searchyear) mod 400 ;years divisible by 400 are leap years. if ( (check4 eq 0 and check100 ne 0) or (check400 eq 0) ) then leap_flag=1 ; ; Determine the last day of the month ; if searchmonth eq 1 then searchday=31 if searchmonth eq 2 and leap_flag eq 0 then searchday=28 if searchmonth eq 2 and leap_flag eq 1 then searchday=29 if searchmonth eq 3 then searchday=31 if searchmonth eq 4 then searchday=30 if searchmonth eq 5 then searchday=31 if searchmonth eq 6 then searchday=30 if searchmonth eq 7 then searchday=31 if searchmonth eq 8 then searchday=31 if searchmonth eq 9 then searchday=30 if searchmonth eq 10 then searchday=31 if searchmonth eq 11 then searchday=30 if searchmonth eq 12 then searchday=31 ; ; Calculate the end time value ; end_base_time=num_sec_ep(searchyear,searchmonth,searchday,23,0,0) print, 'end_base_time', end_base_time ; ; Assign the first array value ; if base_time eq start_base_time then begin ;the data starts at the beginning of the month tempto[0]=time_offset[0] temp_pres[0,*]=pres[0,*] temp_temp[0,*]=temp[0,*] if u_wind_id ne -1 then temp_u_wind[0,*]=u_wind[0,*] if v_wind_id ne -1 then temp_v_wind[0,*]=v_wind[0,*] temp_humid[0,*]=humid[0,*] temp_omega[0,*]=omega[0,*] temp_cloud_h2o_mix[0,*]=cloud_h2o_mix[0,*] temp_conv_lat_heat[0,*]=conv_lat_heat[0,*] temp_stab_lat_heat[0,*]=stab_lat_heat[0,*] temp_sw_heat[0,*]=sw_heat[0,*] temp_lw_heat[0,*]=lw_heat[0,*] temp_cloud_fract[0,*]=cloud_fract[0,*] temp_turb_kin[0,*]=turb_kin[0,*] if ice_mix_id ne -1 then temp_ice_mix[0,*]=ice_mix[0,*] endif else begin ;the data starts after the beginning of the month tempto[0]=long(0) deltas=long(base_time)-long(start_base_time) base_time=long(start_base_time) time_offset=long(time_offset)+long(deltas) ;Adjust time_offset to be off new base_time temp_pres[0,*]=-99999 temp_temp[0,*]=-99999 if u_wind_id ne -1 then temp_u_wind[0,*]=-99999 if v_wind_id ne -1 then temp_v_wind[0,*]=-99999 temp_humid[0,*]=-99999 temp_omega[0,*]=-99999 temp_cloud_h2o_mix[0,*]=-99999 temp_conv_lat_heat[0,*]=-99999 temp_stab_lat_heat[0,*]=-99999 temp_sw_heat[0,*]=-99999 temp_lw_heat[0,*]=-99999 temp_cloud_fract[0,*]=-99999 temp_turb_kin[0,*]=-99999 if ice_mix_id ne -1 then temp_ice_mix[0,*]=-99999 endelse ; ; Loop through the time offset array to find the holes ; for t=1,numtimes-1 do begin ;if it doesn't start at the beginning of the month if t eq 1 and time_offset[0] ne 0 then deltato=time_offset[t-1] $ else deltato=time_offset[t]-time_offset[t-1] if deltato eq 3600 then begin ;there is no hole tt=tt+1 tempto[tt]=time_offset[t] temp_pres[tt,*]=pres[t,*] temp_temp[tt,*]=temp[t,*] if u_wind_id ne -1 then temp_u_wind[tt,*]=u_wind[t,*] if v_wind_id ne -1 then temp_v_wind[tt,*]=v_wind[t,*] temp_humid[tt,*]=humid[t,*] temp_omega[tt,*]=omega[t,*] temp_cloud_h2o_mix[tt,*]=cloud_h2o_mix[t,*] temp_conv_lat_heat[tt,*]=conv_lat_heat[t,*] temp_stab_lat_heat[tt,*]=stab_lat_heat[t,*] temp_sw_heat[tt,*]=sw_heat[t,*] temp_lw_heat[tt,*]=lw_heat[t,*] temp_cloud_fract[tt,*]=cloud_fract[t,*] temp_turb_kin[tt,*]=turb_kin[t,*] if ice_mix_id ne -1 then temp_ice_mix[tt,*]=ice_mix[t,*] ;if printtt eq 1 then begin ;print,tt,tempto[tt]+base_time,tempto[tt]-tempto[tt-1],' o' ;printtt=0 ;endif endif else begin ;there is a hole print, 'found a hole' numb=deltato/3600. if t eq 1 and time_offset[0] ne 0 then numb=numb+1 for k=1,numb do begin ;fill the hole with blank data flags tt=tt+1 if t eq 1 and time_offset[0] ne 0 then tempto[tt]=long(k)*long(3600) $ else tempto[tt]=time_offset[t-1]+long(k)*long(3600) temp_pres[tt,*]=-99999 temp_temp[tt,*]=-99999 if u_wind_id ne -1 then temp_u_wind[tt,*]=-99999 if v_wind_id ne -1 then temp_v_wind[tt,*]=-99999 temp_humid[tt,*]=-99999 temp_omega[tt,*]=-99999 temp_cloud_h2o_mix[tt,*]=-99999 temp_conv_lat_heat[tt,*]=-99999 temp_stab_lat_heat[tt,*]=-99999 temp_sw_heat[tt,*]=-99999 temp_lw_heat[tt,*]=-99999 temp_cloud_fract[tt,*]=-99999 temp_turb_kin[tt,*]=-99999 if ice_mix_id ne -1 then temp_ice_mix[tt,*]=-99999 ;print, tt,tempto[tt]+base_time,tempto[tt]-tempto[tt-1] endfor printtt=1 endelse endfor ; ; Cut the arrays down to their size ; time_offset=tempto[0:tt] pres=temp_pres[0:tt,*] temp=temp_temp[0:tt,*] if u_wind_id ne -1 then u_wind=temp_u_wind[0:tt,*] if v_wind_id ne -1 then v_wind=temp_v_wind[0:tt,*] humid=temp_humid[0:tt,*] omega=temp_omega[0:tt,*] cloud_h2o_mix=temp_cloud_h2o_mix[0:tt,*] conv_lat_heat=temp_conv_lat_heat[0:tt,*] stab_lat_heat=temp_stab_lat_heat[0:tt,*] sw_heat=temp_sw_heat[0:tt,*] lw_heat=temp_lw_heat[0:tt,*] cloud_fract=temp_cloud_fract[0:tt,*] turb_kin=temp_turb_kin[0:tt,*] if ice_mix_id ne -1 then ice_mix=temp_ice_mix[0:tt,*] ; ; Add blanks to the end of the arrays if the data ends before the end of the month ; deltae=end_base_time-base_time-time_offset[n_elements(time_offset)-1] if deltae ne 0 then begin numb=deltae/3600 ;print, numb blank_time_offset=lonarr(numb) for t=0,numb-1 do begin blank_time_offset[t]=long(time_offset[n_elements(time_offset)-1])+long(t+1)*long(3600.) endfor time_offset=[time_offset,blank_time_offset] blanks=make_array(numb,numheights,/float,value=-99999) pres=[pres,blanks] temp=[temp,blanks] if u_wind_id ne -1 then u_wind=[u_wind,blanks] if v_wind_id ne -1 then v_wind=[v_wind,blanks] humid=[humid,blanks] omega=[omega,blanks] cloud_h2o_mix=[cloud_h2o_mix,blanks] conv_lat_heat=[conv_lat_heat,blanks] stab_lat_heat=[stab_lat_heat,blanks] sw_heat=[sw_heat,blanks] lw_heat=[lw_heat,blanks] cloud_fract=[cloud_fract,blanks] turb_kin=[turb_kin,blanks] if ice_mix_id ne -1 then ice_mix=[ice_mix,blanks] endif ; ; Determine new array parameters ; numtimes=n_elements(time_offset) ; ; Zip up the data files and change permissions ; unix_command='gzip -fq '+armfile ;zip the data files spawn,unix_command unix_command='gunzip -fq *gif.gz' ;unzip any gif files unintentionally zipped spawn,unix_command unix_command='chmod 664 '+armfile ;change permissions spawn,unix_command unix_command='chgrp met-mace '+armfile ;change group spawn,unix_command return end