#! /bin/ksh # ##################################### #Code created on 21/10/2010 #Runs ESRAD for aerocom cases: #Trop and Sub Arctic Winter (saw) profiles #szen of 30 and 75 #6 Band Version #NB VIS (0.2-0.7um) here is bands 1 to 3 inclusive which is actually 0.2-0.69um) #550 band here (if even appropriate) is band 2 and 3 - actually 0.32-0.69um) #Clear sky, aerosol abs and aerosol scat #This version runs with the rescaling flag off. This is because we are interested in both diffuse and total flux, so need to preserve the direct flux so that diffuse is also accurate. ############################################### ### These are the specifiables ###### ############################################### # Define dirs where basic input files are: base_dir=/export/sneeze/disk2/jp902366/ESRAD_1009/aerocom store_dir=$base_dir/input_store #spectral file directory sp_dir=$store_dir/spfiles #Define dirs where output files are to be: output_base=$base_dir/output_6band ############################################### #Atmospheric profiles: atmos[0]=saw_profiles atmos[1]=trop_profiles #Szen values szen[0]=szen30 szen[1]=szen75 #aerosol_cases aer_case[0]=clr #clear sky aer_case[1]=sca #scattering aerosol aer_case[2]=abs #absorbing aerosol #Spectral cases spec_case[0]=b6_resoff #Full 6 bands to be run spec_case[1]=vis_resoff #Visible wavelengths only spec_case[2]=550nm #Band containing 550nm only for AOD purposes band_min[0]=1 #Bands 1 to 6 for full 6 band case band_max[0]=6 #Bands 1 to 6 for full 6 band case band_min[1]=1 #Bands 1 to 3 for visible spectrum only case band_max[1]=3 #Bands 1 to 3 for visible spectrum only case band_min[2]=2 #Bands 2 to 3 for 550nm band band_max[2]=3 #Bands 2 to 3 for 550nm band #Define basename for ESRAD files base=aerocom ############################################### # BEGIN MAIN CODE ############################################### ############################################### # Loop over different atmospheric profiles ############################################### for iatmos in 0 1 do echo 'Now executing for atmospheric profile: ' ${atmos[iatmos]} atmos_dir=$output_base/${atmos[iatmos]} mkdir $atmos_dir ############################################### # Loop over different szen angles ############################################### for iszen in 0 1 do echo 'Now executing for szen: ' ${szen[iszen]} szen_dir=$atmos_dir/${szen[iszen]} mkdir $szen_dir ############################################### # Loop over different aerosol cases ############################################### for iaer in 0 1 2 do echo 'Now executing for aer case: ' ${aer_case[iaer]} aer_dir=$szen_dir/${aer_case[iaer]} mkdir $aer_dir #Define spectral file if [ $iaer -le 1 ] then sp_file_full_path=$sp_dir/spectral_6_sca sp_name=spectral_6_sca else sp_file_full_path=$sp_dir/spectral_6_abs sp_name=spectral_6_abs fi ############################################### # Loop over different spectral regions ############################################### for ispec in 0 1 2 do echo 'Now executing for spectral region: ' ${spec_case[ispec]} spec_dir=$aer_dir/${spec_case[ispec]} mkdir $spec_dir #Copy input files to relevant dir for running of esrad cp $store_dir/${atmos[iatmos]}/* $spec_dir cp $store_dir/${szen[iszen]}/aerocom.szen $spec_dir #Also copy spectral file as full path length is too long for ESRAD... Doh! cp $sp_file_full_path $spec_dir #Change to the dir ready to run esrad cd $spec_dir echo 'running esrad from dir ' $spec_dir #Remove result files in case they already exist \rm *.hrts *.vflx *.sflx *.uflx *.nflx *.dflx ########################## ##### run the ES code ##### if [ $iaer -eq 0 ] then #############CLEAR SKY CASES############# #spectral case clear sky with rescaling flag off nice Cl_run_cdf -s $sp_name -R ${band_min[ispec]} ${band_max[ispec]} -S -c -g 2 -r -G 5 0 -C 5 -B $base -t 2 -v 1 else #############AEROSOL CASES############# #spectral case aerosol with rescaling flag off nice Cl_run_cdf -s $sp_name -R ${band_min[ispec]} ${band_max[ispec]} -S -c -g 2 -r -G 5 0 -C 5 -B $base -t 2 -v 1 -a fi ########################## #Remove input files from current dir \rm aerocom.aunch aerocom.co aerocom.n2o aerocom.o3 aerocom.stoa aerocom.szen aerocom.tl aerocom.ch4 aerocom.co2 aerocom.o2 aerocom.q aerocom.surf aerocom.t \rm $sp_name #Change back to top dir cd $base_dir #End loop over spectral regions done #End loop over aer cases done #End loop over szens done #Change back to top dir cd $base_dir #End loop over profiles done #Change back to top dir cd $base_dir echo 'Finished!!!!'