pro get_aeri_mod3, curdate,site,datastream,input_flag common aeri_mod3_data, base_time, time_offset, $ aeri_tb,mod3_tb,z_tb ; ; Pieces to use to make the directory and filename ; if input_flag eq 'one' then begin if site eq 'twpc1' then begin armdatadir='/data/mace/arm_data/twp/Manus_C1/' datastream='twpaeri_mod3_comp_11micron' endif else if site eq 'twpc2' then begin armdatadir='/data/mace/arm_data/twp/Nauru_C2/' datastream='twpaeri_mod3_comp_11micron' endif else if site eq 'nsa' then begin armdatadir='/data/mace2/arm_data/nsa/' datastream='nsaaeri_mod3_comp_11micron' endif else if site eq 'sgp' then begin armdatadir='/data/mace3/arm_data/sgp/' datastream='sgpaeri_mod3_comp_11micron' endif armfile=armdatadir+datastream+'/'+'*'+curdate+'*.cd*' endif else if input_flag eq 'eos' then begin if site eq 'twpc1' then begin armdatadir='/data/mace/arm_data/twp/Manus_C1/' eosfilename='twpC1.eos_val_mace.c1' datastream='twpaeri_mod3_comp_11micron' endif else if site eq 'twpc2' then begin armdatadir='/data/mace/arm_data/twp/Nauru_C2/' eosfilename='twpC2.eos_val_mace.c1' datastream='twpaeri_mod3_comp_11micron' endif else if site eq 'nsa' then begin armdatadir='/data/mace2/arm_data/nsa/' eosfilename='nsaC1.eos_val_mace.c1' datastream='nsaaeri_mod3_comp_11micron' endif else if site eq 'sgp' then begin armdatadir='/data/mace3/arm_data/sgp/' eosfilename='sgpC1.eos_val_mace.c1' datastream='sgpaeri_mod3_comp_11micron' endif armfile=armdatadir+eosfilename+'/'+eosfilename+'.'+curdate+'*.cd*' endif ; ; Unzip the data files ; unix_command='gunzip -fq '+armfile spawn,unix_command ; ; Get a list of the matching filenames ; print, 'filename ',armfile files=findfile(armfile,count=count) print, 'files ',files print, 'count ',count if count eq 0 then exit ;no files for this day ; ; Process files ; j=-1 ;counts number of cdf files for i=0,count-1 do begin ;do for all the matching files in the directory ; ; Don't try to process any gif or png 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 ; ; Open the netcdf file ; cdfid=ncdf_open(files[i]) ; ; Get the dimension id's ; time_did=ncdf_dimid(cdfid,'time') ; ; Get the variable id's ; base_time_id=ncdf_varid(cdfid,'base_time') time_offset_id=ncdf_varid(cdfid,'time_offset') aeri_tb_id=ncdf_varid(cdfid,'aeri_tb') mod3_tb_id=ncdf_varid(cdfid,'mod3_tb') z_tb_id=ncdf_varid(cdfid,'z_tb') ; ; Get the data ; 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 aeri_tb_id ne -1 then ncdf_varget, cdfid, aeri_tb_id, aeri_tb if mod3_tb_id ne -1 then ncdf_varget, cdfid, mod3_tb_id, mod3_tb if z_tb_id ne -1 then ncdf_varget, cdfid, z_tb_id, z_tb ; ; Combine the data into big arrays ; if j eq 0 then begin ;if it is the first file if time_offset_id ne -1 then com_btto=base_time+time_offset if aeri_tb_id ne -1 then com_aeri_tb=aeri_tb if mod3_tb_id ne -1 then com_mod3_tb=mod3_tb if z_tb_id ne -1 then com_z_tb=z_tb endif else begin ;if it is not the first file if time_offset_id ne -1 then com_btto=[com_btto,base_time+time_offset] if aeri_tb_id ne -1 then com_aeri_tb=[com_aeri_tb,aeri_tb] if mod3_tb_id ne -1 then com_mod3_tb=[com_mod3_tb,mod3_tb] if z_tb_id ne -1 then com_z_tb=[com_z_tb,z_tb] endelse ;end of if it is the first file ; ; Close the netcdf file ; ncdf_close,cdfid endif ;only process cdf files endfor ;loop through number of matching file names ; ; Skip the rest if there are no files ; if j lt 0 then print, 'found no files' if j lt 0 then exit ; ; Skip the rest if there are no variables ; if aeri_tb_id eq -1 and mod3_tb_id eq -1 and z_tb_id eq -1 $ then begin if input_flag eq 'eos' then begin openw,15,'/data/mace4/arm_data/eos/eos_image_name.dat' printf,15,0 close,15 endif print, 'found no variables' ; ; Zip up the data files ; 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 exit endif ; ; Create the final arrays ; if base_time_id ne -1 then base_time=com_btto[0] if time_offset_id ne -1 then time_offset=com_btto-com_btto[0] if aeri_tb_id ne -1 then aeri_tb=com_aeri_tb if mod3_tb_id ne -1 then mod3_tb=com_mod3_tb if z_tb_id ne -1 then z_tb=com_z_tb ; ; Zip up the data files ; 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