; Directly download granules ; Dec 2018, Jan and Feb 2019 ;https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/61/ ; Search for granules in a date time range ;https://search.earthdata.nasa.gov/search ; In the search box put MYD06_L2 and select the dataset. ; Enter time using calendar button. Enter box using spacial rectangle SW=-76,58 NE=-49,152 ; **SW=-76,40 NE=-45,152 ;bigger antarctic ; ***order mod03 for trajectory analysis ; SW=-80,20 NE=-25,179 ; ; Click download all ; direct download ; click download data ; view/download data links ; download links file ;short Cloud_Water_Path(Cell_Along_Swath_1km:mod06, Cell_Across_Swath_1km:mod06) ; ;Cloud_Water_Path:valid_range = 0s, 10000s ; ;Cloud_Water_Path:_FillValue = -9999s ; ;Cloud_Water_Path:long_name = "Column Water Path two-band retrieval using band 7 and either band 1, 2, or 5 (specified in Quality_Assurance_1km)from best points: not failed in any way, not marked for clear sky restoral" ; ;Cloud_Water_Path:units = "g/m^2" ; ;Cloud_Water_Path:scale_factor = 1. ; ;Cloud_Water_Path:add_offset = 0. ; ;Cloud_Water_Path:Parameter_Type = "Output" ; ;Cloud_Water_Path:Cell_Along_Swath_Sampling = 1, 2040, 1 ; ;Cloud_Water_Path:Cell_Across_Swath_Sampling = 1, 1354, 1 ; ;Cloud_Water_Path:Geolocation_Pointer = "External MODIS geolocation product" ; pro read_mod06_clouds_sb_test ; imac or chpc ;path_prefix='/Volumes/' path_prefix='/uufs/chpc.utah.edu/common/home/' ; Choose Aqua or Terra ;eos='MYD' eos='MOD' ; Time range to analyze ; SEASON Nov 2018-Feb 2019 ;julian_day_1d=timegen(start=julday(11,1,2018,0,0,0),final=julday(11,30,2018,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(12,30,2018,0,0,0),final=julday(12,30,2018,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(1,1,2019,0,0,0),final=julday(1,31,2019,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(2,1,2019,0,0,0),final=julday(2,28,2019,23,59,59),units='days',step_size=1) ; SEASON Nov 2017-Feb 2018 ;julian_day_1d=timegen(start=julday(11,1,2017,0,0,0),final=julday(11,30,2017,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(12,1,2017,0,0,0),final=julday(12,31,2017,23,59,59),units='days',step_size=1) julian_day_1d=timegen(start=julday(1,1,2018,0,0,0),final=julday(1,31,2018,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(2,1,2018,0,0,0),final=julday(2,28,2018,23,59,59),units='days',step_size=1) ; SEASON Nov 2016-Feb 2017 ;julian_day_1d=timegen(start=julday(11,1,2016,0,0,0),final=julday(11,30,2016,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(12,1,2016,0,0,0),final=julday(12,1,2016,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(1,1,2017,0,0,0),final=julday(1,31,2017,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(2,1,2017,0,0,0),final=julday(2,28,2017,23,59,59),units='days',step_size=1) ; SEASON Nov 2015-Feb 2016 ;julian_day_1d=timegen(start=julday(11,1,2015,0,0,0),final=julday(11,30,2015,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(12,1,2015,0,0,0),final=julday(12,31,2015,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(1,1,2016,0,0,0),final=julday(1,31,2016,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(2,1,2016,0,0,0),final=julday(2,29,2016,23,59,59),units='days',step_size=1) ; SEASON Nov 2014-Feb 2015 ;julian_day_1d=timegen(start=julday(11,1,2014,0,0,0),final=julday(11,30,2014,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(12,1,2014,0,0,0),final=julday(12,31,2014,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(1,1,2015,0,0,0),final=julday(1,31,2015,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(2,1,2015,0,0,0),final=julday(2,28,2015,23,59,59),units='days',step_size=1) ; SEASON Nov 2006-Feb 2007 ;julian_day_1d=timegen(start=julday(11,1,2006,0,0,0),final=julday(11,30,2006,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(12,1,2006,0,0,0),final=julday(12,31,2006,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(1,1,2007,0,0,0),final=julday(1,31,2007,23,59,59),units='days',step_size=1) ;julian_day_1d=timegen(start=julday(2,1,2007,0,0,0),final=julday(2,28,2007,23,59,59),units='days',step_size=1) ; Get day of year array numtimes=n_elements(julian_day_1d) caldat,julian_day_1d,mm,dd,yy,hh,mi,ss doy=make_array(/int,numtimes,value=-9999) for i=0,n_elements(julian_day_1d)-1 do begin ;print,yy[i],mm[i],dd[i],hh[i],mi[i],ss[i] julian_date,yy[i],mm[i],dd[i],doy1 doy[i]=doy1 endfor ; Choose year ;syear='2014' syear=string(yy[0],format='(I4)') ;smonth='11' smonth=string(mm[0],format='(I02)') ; To run transition cases, uncomment the date you want to run ;sdate='20171112' ;sdate='20171124' ;sdate='20171231' ;sdate='20180105' ;sdate='20180106' ;sdate='20180129' ;sdate='20180131' ;sdate='20180201' ;sdate='20180202' ;sdate='20180218' ;sdate='20180219' ; Output path if sdate eq !NULL then begin output_path=path_prefix+'mace-group4/modis/hysplit/modis_histograms_sm/' ;&&&& endif else begin output_path=path_prefix+'mace-group4/modis/transitions/'+sdate+'/' endelse ; Modis hdf file directory if sdate eq !NULL then begin fdir06=path_prefix+'mace-group6/modis/'+eos+'06_L2/'+syear+smonth+'/' ;&&&& fdir03=path_prefix+'mace-group6/modis/'+eos+'03/'+syear+smonth+'/' ;&&&& endif else begin fdir06=output_path+'hdf_files/' fdir03=output_path+'hdf_files/' endelse ; Loop through a range of days for n=0,numtimes-1 do begin ;for n=329,329 do begin ;old loop through doy number ;for n=1,1 do begin print,'doy',doy[n],'*************' nstr=string(doy[n],format='(I03)') if sdate eq !NULL then begin ;mod06_files=file_search(fdir06+'MYD06_L2.A2017*hdf',count=num_mod06) mod06_files=file_search(fdir06+eos+'06_L2.A'+syear+nstr+'*hdf',count=num_mod06) ;mod06_files=file_search(fdir06+eos+'06_L2.A'+syear+nstr+'.2355.'+'*hdf',count=num_mod06) ;mod06_files=file_search(fdir06+'MYD06_L2.A2017354*hdf',count=num_mod06) ;mod06_files=file_search(fdir06+'MYD06_L2.A2017001.0630.061.2018029080414.hdf',count=num_mod06) endif else begin ; need the doy of sdate=nstr mod06_files=file_search(fdir06+eos+'06_L2.A'+strmid(sdate,0,4)+nstr+'*1115*hdf',count=num_mod06) endelse print,'num_mod06',num_mod06 ; Loop through the modis granules for that day of the year for f=0,num_mod06-1 do begin mod06_file=mod06_files[f] print, mod06_file ; Pulls out the string 'MYD06_L2.A2018006.0625.061.2018006194906' output_file_string=strmid(file_basename(mod06_file),0,40) ; Pick up the matching myd03 file parts=strsplit(file_basename(mod06_file),'.',/extract) syear=strmid(parts[1],1,4) sdoy=strmid(parts[1],5,3) mod03_file=file_search(fdir03+eos+'03.'+parts[1]+'.'+parts[2]+'.'+parts[3]+'*hdf',count=numfiles) mod03_file=mod03_file[0] ; If found a matching myd03 file if numfiles eq 1 then begin print,'found ',mod03_file ; Read myd03 and myd06 hdf files ;MOD03.A2018051.0010.061.2018051070825.hdf has -999.000 values in lat_1km,lon_1km file_id=hdf_sd_start(mod03_file) x_id=hdf_sd_nametoindex(file_id,'Latitude') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,lat_1km hdf_sd_endaccess,x_id2 x_id=hdf_sd_nametoindex(file_id,'Longitude') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,lon_1km hdf_sd_endaccess,x_id2 hdf_sd_end,file_id file_id=hdf_sd_start(mod06_file) x_id=hdf_sd_nametoindex(file_id,'Latitude') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,lat_5km hdf_sd_endaccess,x_id2 x_id=hdf_sd_nametoindex(file_id,'Longitude') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,lon_5km hdf_sd_endaccess,x_id2 x_id=hdf_sd_nametoindex(file_id,'Scan_Start_Time') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,scan_start_time hdf_sd_endaccess,x_id2 day=julday(1,1,1993,0,0,0) & julian_day=day+(scan_start_time/86400.d) caldat, julian_day[0,0], smm, sdd, syy, shh, smi, sss print,'first scan time',syy,smm,sdd,shh,smi,sss ;Null value of -327.670 x_id=hdf_sd_nametoindex(file_id,'Solar_Zenith') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,solar_zenith_angle hdf_sd_endaccess,x_id2 solar_zenith_angle=float(solar_zenith_angle)*0.01 ;Null value of -327.670 x_id=hdf_sd_nametoindex(file_id,'Sensor_Zenith') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,sensor_zenith_angle hdf_sd_endaccess,x_id2 sensor_zenith_angle=float(sensor_zenith_angle)*0.01 ; scale_factor=0.01 offset=0 fillvalue=-9999 1KM x_id=hdf_sd_nametoindex(file_id,'Cloud_Effective_Radius') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,cloud_effective_radius2 hdf_sd_endaccess,x_id2 scaleid=hdf_sd_attrfind(x_id2,'scale_factor') hdf_sd_attrinfo,x_id2,scaleid,data=scale_factor ;0.01 scale_factor=scale_factor[0] cloud_effective_radius=float(cloud_effective_radius2)*scale_factor r=where(cloud_effective_radius2 eq -9999,c) if c gt 0 then cloud_effective_radius[r]=-9999 ; scale_factor=0.01 offset=-15000 fillvalue=-32768 5KM x_id=hdf_sd_nametoindex(file_id,'Cloud_Top_Temperature') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,cloud_top_temperature2 hdf_sd_endaccess,x_id2 scaleid=hdf_sd_attrfind(x_id2,'scale_factor') hdf_sd_attrinfo,x_id2,scaleid,data=scale_factor ;0.01 scale_factor=scale_factor[0] offsetid=hdf_sd_attrfind(x_id2,'add_offset') hdf_sd_attrinfo,x_id2,offsetid,data=offset ;-15000.000 offset=offset[0] cloud_top_temperature=((float(cloud_top_temperature2)-offset)*scale_factor) ;modis ;cloud_top_temperature=((float(cloud_top_temperature2))*scale_factor)+150.0 ;jay cloud_top_temperature=cloud_top_temperature-273. ;convert to celcius r=where(cloud_top_temperature2 eq -32768,c) if c gt 0 then cloud_top_temperature[r]=-9999 ; scale_factor=0.01 offset=-15000 fillvalue=-32768 x_id=hdf_sd_nametoindex(file_id,'Surface_Temperature') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,surface_temperature2 hdf_sd_endaccess,x_id2 scaleid=hdf_sd_attrfind(x_id2,'scale_factor') hdf_sd_attrinfo,x_id2,scaleid,data=scale_factor ;0.01 scale_factor=scale_factor[0] offsetid=hdf_sd_attrfind(x_id2,'add_offset') hdf_sd_attrinfo,x_id2,offsetid,data=offset ;-15000.000 offset=offset[0] surface_temperature=((float(surface_temperature2)-offset)*scale_factor) ;modis ;surface_temperature=((float(surface_temperature2))*scale_factor)+150. ;jay surface_temperature=surface_temperature-273. ;convert to celcius ; scale_factor=0.1 offset=0 fillvalue=-32768 5KM x_id=hdf_sd_nametoindex(file_id,'Cloud_Top_Pressure') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,cloud_top_pressure2 hdf_sd_endaccess,x_id2 scaleid=hdf_sd_attrfind(x_id2,'scale_factor') hdf_sd_attrinfo,x_id2,scaleid,data=scale_factor ;0.1 scale_factor=scale_factor[0] cloud_top_pressure=(float(cloud_top_pressure2)*scale_factor)*100. ; pa r=where(cloud_top_pressure2 eq -32768,c) if c gt 0 then cloud_top_pressure[r]=-9999 ; scale_factor=0.01 offset=0 fillvalue=-9999 1KM x_id=hdf_sd_nametoindex(file_id,'Cloud_Optical_Thickness') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,cloud_optical_thickness2 hdf_sd_endaccess,x_id2 scaleid=hdf_sd_attrfind(x_id2,'scale_factor') hdf_sd_attrinfo,x_id2,scaleid,data=scale_factor ;0.01 scale_factor=scale_factor[0] cloud_optical_thickness=float(cloud_optical_thickness2)*scale_factor r=where(cloud_optical_thickness2 eq -9999,c) if c gt 0 then cloud_optical_thickness[r]=-9999 ; scale_factor=1.0 offset=0 fillvalue=0 1KM x_id=hdf_sd_nametoindex(file_id,'Cloud_Phase_Optical_Properties') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2,cloud_phase hdf_sd_endaccess,x_id2 ; scale_factor=1 offset=0 fillvalue=-9999 x_id=hdf_sd_nametoindex(file_id,'Cloud_Water_Path') x_id2=hdf_sd_select(file_id,x_id) hdf_sd_getdata,x_id2, cloud_water_path hdf_sd_endaccess,x_id2 cloud_water_path=float(cloud_water_path) ; Close file hdf_sd_end,file_id print,'finished reading data' ; The size of the data arrays s=size(lat_1km,/dimensions) numx_1km=s[0] ;lat_1km[*,0] numy_1km=s[1] ;lat_1km[0,*] s=size(lat_5km,/dimensions) numx_5km=s[0] ;lon_low_res[*,0] numy_5km=s[1] ;lat_low_res[0,*] ; Calculate colongitude colon_1km=lon_1km result=where(colon_1km lt 0 and colon_1km ne -999.00,count) if count gt 0 then colon_1km[result]=360.0+colon_1km[result] colon_5km=lon_5km result=where(colon_5km lt 0,count) if count gt 0 then colon_5km[result]=360.0+colon_5km[result] ;**************************************************** ; Create an Nd array on the MODIS grid ;**************************************************** print,'start nd array' ; Increase resolution from 5km to 1km cloud_top_temp_1km=congrid(cloud_top_temperature,numx_1km,numy_1km) sensor_zenith_angle_1km=congrid(sensor_zenith_angle,numx_1km,numy_1km) solar_zenith_angle_1km=congrid(solar_zenith_angle,numx_1km,numy_1km) ;p0=contour(cloud_top_temp_1km,lon_1km,lat_1km,irregular=0) ;p1=contour(cloud_top_temperature,lon_5km,lat_5km,color='red',irregular=0) ; These arrrays are calculated nd_array=make_array(/float,numx_1km,numy_1km,value=-9999) cw=make_array(/float,numx_1km,numy_1km,value=-9999) r=where(cloud_effective_radius gt 0 and cloud_water_path gt 0 and cloud_phase eq 2,count) if count gt 0 then begin cw[r]=0.6+((0.9/20.)*((cloud_top_temp_1km[r])+20.)) ; parameterized fro Wood's figure 1 r2=where(cw lt 0.4 and cw ne -9999,c2) if c2 gt 0 then begin cw[r2]=0.4 endif nd_array[r]=((sqrt(5.)/(2.*!pi*0.8))*sqrt((0.8*cw[r]*(1.e-6)*$ cloud_optical_thickness[r])/(2.*1000.*(((1.e-6)*(cloud_effective_radius[r]))^5))))*1.e-6 ; Grosvenor et al 2018, eq 11 converted to 1/cm3 endif print,'end nd array' ;**************************************************************** ; Carve out the microphysics for histogram writing in lat-lon regions. ; Only liquid phase cloud data with LWP < 250 g/m2 is used. ; Require view zenith to be less than 30 and solar zenith to be less than 60 ;**************************************************************** ; Check to see if there is any data that meets our conditions ; 0 30=gold',font_size=10,color='gold') t2=text(pos[pnum,0]+0*dx,pos[pnum,3]+1.5*dy,'solar zenith > 60=red',font_size=10,color='red') t3=text(pos[pnum,0]+0*dx,pos[pnum,3]+0*dy,'sensor zenith > 30 & solar zenith > 60=orange',font_size=10,color='orange') ;t1=text(pos[pnum,0],pos[pnum,3]+dy,'Good data=solzen<60 senzen<30 re0-50 liq phase',font_size=12) plot_good_data=grid_var endif ; Sensor Zenith Angle 1km if 1 eq 1 then begin print,'sensor zenith' pnum=0 data_var=sensor_zenith_angle_1km data_lat=lat_1km data_lon=colon_1km r=where(data_var gt -300.0,c) dmax=max(data_var[r]) dmin=min(data_var[r]) good_lat=data_lat[r] good_lon=data_lon[r] good_var=data_var[r] grid_input,good_lon,good_lat,good_var,xyz,newdata_var,/degree,/sphere,duplicates='Avg',epsilon=0.01 lon = !radeg * atan(xyz[1,*],xyz[0,*]) & lat = !radeg * asin(xyz[2,*]) ; Triangulate the data qhull,lon,lat,triangles,/delaunay,sphere=s grid_var=griddata(lon,lat,newdata_var,xout=grid_lon,yout=grid_lat,$ /grid,/degrees,/sphere,triangles=triangles,$ /kriging,min_points=16,sectors=8,empty_sectors=3,missing=-9999) ;r=where(grid_var ge 0.5,c) ;if c gt 0 then grid_var[r]=1 ;r=where(grid_var lt 0.5,c) ;if c gt 0 then grid_var[r]=0 ; Bytscal the data data_image=bytscl(grid_var,top=top_color,min=dmin,max=dmax) result=where(grid_var eq -9999 or grid_var eq -327.670,count) if count gt 0 then data_image[result]=255 ;gray p1=image(data_image,grid_lon,grid_lat,$ ; I have called this one p1 limit=[llat,llon,ulat,rlon],$ ;map limit vector /current,$ ;Put it in the current open plot window p0 grid_units='degrees',$ center_longitude=((rlon-llon)/2.0)+llon,$ /box_axes,$ label_position=label_pos,$ font_size=12,$ ;bigger font linestyle=2,$ ;grid will be dashed line rgb_table=mytable,$ ;use color table 5 map_projection=map_projection,$ ;map projection position=pos[pnum,*]) p2=mapcontinents(color='white',/hires,thick=2) ;add the continent lines ; Put on a colorbar c0=colorbar(range=[dmin,dmax],$ ;the colorbar is to match the image labeled p1 orientation=1,position=reform(cbpos[pnum,*]),font_size=12,rgb_table=mycbtable,$ tickdir=1,border_on=1,title='Sensor Zenith 1km') t1=text(pos[pnum,0],pos[pnum,3]+dy,'Sensor Zenith lt 30',font_size=12) plot_sensor_zenith=grid_var endif p0.save,out_dir+output_file_string+'.lwp_tau.png',height=pydim ;**************************** ; Start next image ;**************************** pnum=0 p0=plot([0,1],[0,1],position=pos[pnum,*],/buffer,dimensions=[pxdim,pydim],axis_style=4,/nodata) ; CLOUD_TOP_TEMP_1km print,'cloud top temp 1km' pnum=0 data_var=cloud_top_temp_1km data_var=data_var;[0:*:10,0:*:10] data_lat=lat_1km;[0:*:10,0:*:10] data_lon=colon_1km;[0:*:10,0:*:10] r=where(data_var ne -9999,c) dmax_temp=max(data_var[r]) dmin_temp=min(data_var[r]) good_lat=data_lat[r] good_lon=data_lon[r] good_var=data_var[r] grid_input,good_lon,good_lat,good_var,xyz,newdata_var,/degrees,/sphere,duplicates='Avg',epsilon=0.01 lon = !radeg * atan(xyz[1,*],xyz[0,*]) & lat = !radeg * asin(xyz[2,*]) ; Triangulate the data ;qhull,good_lon,good_lat,triangles,/delaunay,sphere=s qhull,lon,lat,triangles,/delaunay,sphere=s ;grid_var=griddata(good_lon,good_lat,good_var,xout=grid_lon,yout=grid_lat,$ grid_var=griddata(lon,lat,newdata_var,xout=grid_lon,yout=grid_lat,$ /grid,/degrees,/sphere,triangles=triangles,$ /kriging,min_points=16,sectors=8,empty_sectors=3,missing=-9999) ; Bytscal the data data_image=bytscl(grid_var,top=top_color,min=dmin_temp,max=dmax_temp) result=where(grid_var eq -9999,count) if count gt 0 then data_image[result]=255 ;gray p1=image(data_image,grid_lon,grid_lat,$ ; I have called this one p1 limit=[llat,llon,ulat,rlon],$ ;map limit vector /current,$ ;Put it in the current open plot window p0 grid_units='degrees',$ center_longitude=((rlon-llon)/2.0)+llon,$ ;max_value=dmax_temp,min_value=dmin_temp,$ /box_axes,$ label_position=label_pos,$ font_size=12,$ ;bigger font linestyle=2,$ ;grid will be dashed line rgb_table=mytable,$ ;use color table 5 map_projection=map_projection,$ ;map projection position=pos[pnum,*]) p2=mapcontinents(color='white',/hires,thick=2) ;add the continent lines p3=plot([bllon,brlon,brlon,bllon,bllon],[bllat,bllat,bulat,bulat,bllat],/overplot,/data,color='green',thick=3) ; Put on a colorbar c0=colorbar(range=[dmin_temp,dmax_temp],$ ;the colorbar is to match the image labeled p1 orientation=1,position=reform(cbpos[pnum,*]),font_size=12,rgb_table=mycbtable,$ tickdir=1,border_on=1,title='Cloud Top Temp 1km') t1=text(pos[pnum,0],pos[pnum,3]+dy,'Cloud Top Temp 1km',font_size=12) plot_cloud_top_temp=grid_var ; CLOUD_TOP_TEMPERATURE if 1 eq 0 then begin print,'cloud top temp 5km' data_var=cloud_top_temperature data_var=data_var;[0:*:2,0:*:2] data_lat=lat_5km;[0:*:2,0:*:2] data_lon=colon_5km;[0:*:2,0:*:2] r=where(data_var ne -9999,c) dmax_temp=max(data_var[r]) dmin_temp=min(data_var[r]) good_lat=data_lat[r] good_lon=data_lon[r] good_var=data_var[r] ; Triangulate the data qhull,good_lon,good_lat,triangles,/delaunay,sphere=s grid_var=griddata(good_lon,good_lat,good_var,xout=grid_lon,yout=grid_lat,$ /grid,/degrees,/sphere,triangles=triangles,$ /kriging,min_points=16,sectors=8,empty_sectors=3,missing=-9999) ; Bytscal the data data_image=bytscl(grid_var,top=top_color,min=dmin_temp,max=dmax_temp) result=where(grid_var eq -9999,count) if count gt 0 then data_image[result]=255 ;gray pnum=1 p1=image(data_image,grid_lon,grid_lat,$ ; I have called this one p1 limit=[llat,llon,ulat,rlon],$ ;map limit vector /current,$ ;Put it in the current open plot window p0 grid_units='degrees',$ center_longitude=((rlon-llon)/2.0)+llon,$ /box_axes,$ label_position=label_pos,$ font_size=12,$ ;bigger font linestyle=2,$ ;grid will be dashed line rgb_table=mytable,$ ;use color table 5 map_projection=map_projection,$ ;map projection position=pos[pnum,*]) p2=mapcontinents(color='white',/hires,thick=2) ;add the continent lines ; Put on a colorbar c0=colorbar(range=[dmin_temp,dmax_temp],$ ;the colorbar is to match the image labeled p1 orientation=1,position=reform(cbpos[pnum,*]),font_size=12,rgb_table=mycbtable,$ tickdir=1,border_on=1,title='Cloud Top Temp 5km') endif ; CLOUD_EFFECTIVE_RADIUS print,'cloud effective radius' if 1 eq 1 then begin pnum=1 data_var=cloud_effective_radius data_var=data_var data_lat=lat_1km data_lon=colon_1km r=where(data_var ne -9999,c) if c gt 5 then begin dmax_re=30;max(data_var[r]) dmin_re=0;min(data_var[r]) good_lat=data_lat[r] good_lon=data_lon[r] good_var=data_var[r] grid_input,good_lon,good_lat,good_var,xyz,newdata_var,/degree,/sphere,duplicates='Avg',epsilon=0.01 lon = !radeg * atan(xyz[1,*],xyz[0,*]) & lat = !radeg * asin(xyz[2,*]) ; Triangulate the data ;qhull,good_lon,good_lat,triangles,/delaunay,sphere=s qhull,lon,lat,triangles,/delaunay,sphere=s ;triangulate,good_lon,good_lat,triangles,sphere=s ;grid_var=griddata(good_lon,good_lat,good_var,xout=grid_lon,yout=grid_lat,$ grid_var=griddata(lon,lat,newdata_var,xout=grid_lon,yout=grid_lat,$ /grid,/degrees,/sphere,triangles=triangles,$ /kriging,min_points=16,sectors=8,empty_sectors=3,missing=-9999) ; Bytscal the data data_image=bytscl(grid_var,top=top_color,min=dmin_re,max=dmax_re) result=where(grid_var eq -9999,count) if count gt 0 then data_image[result]=255 ;gray p1=image(data_image,grid_lon,grid_lat,$ ; I have called this one p1 limit=[llat,llon,ulat,rlon],$ ;map limit vector /current,$ ;Put it in the current open plot window p0 grid_units='degrees',$ center_longitude=((rlon-llon)/2.0)+llon,$ /box_axes,$ label_position=label_pos,$ font_size=12,$ ;bigger font linestyle=2,$ ;grid will be dashed line rgb_table=mytable,$ ;use color table 5 map_projection=map_projection,$ ;map projection position=pos[pnum,*]) p2=mapcontinents(color='white',/hires,thick=2) ;add the continent lines p3=plot([bllon,brlon,brlon,bllon,bllon],[bllat,bllat,bulat,bulat,bllat],/overplot,/data,color='green',thick=3) ; Put on a colorbar c0=colorbar(range=[dmin_re,dmax_re],$ ;the colorbar is to match the image labeled p1 orientation=1,position=reform(cbpos[pnum,*]),font_size=12,rgb_table=mycbtable,$ tickdir=1,border_on=1,title='Cloud Effective Radius 1km') t1=text(pos[pnum,0],pos[pnum,3]+dy,'Cloud Effective Radius 1km',font_size=12) plot_effective_radius=grid_var ;output regridded array endif else begin plot_effective_radius=make_array(n_elements(grid_lon),n_elements(grid_lat),value=-9999) endelse endif ; ND_ARRAY print,'nd array' if 1 eq 1 then begin pnum=2 data_var=nd_array ;r=where(data_var gt 0,c) ;data_var[r]=alog10(data_var[r]) data_lat=lat_1km data_lon=colon_1km r=where(data_var ne -9999,c) if c gt 5 then begin dmax_nd=200;max(data_var[r]) dmin_nd=0;min(data_var[r]) good_lat=data_lat[r] good_lon=data_lon[r] good_var=data_var[r] grid_input,good_lon,good_lat,good_var,xyz,newdata_var,/degree,/sphere,duplicates='Avg',epsilon=0.01 lon = !radeg * atan(xyz[1,*],xyz[0,*]) & lat = !radeg * asin(xyz[2,*]) ; Triangulate the data ;qhull,good_lon,good_lat,triangles,/delaunay,sphere=s qhull,lon,lat,triangles,/delaunay,sphere=s ;triangulate,good_lon,good_lat,triangles,sphere=s ;grid_var=griddata(good_lon,good_lat,good_var,xout=grid_lon,yout=grid_lat,$ grid_var=griddata(lon,lat,newdata_var,xout=grid_lon,yout=grid_lat,$ /grid,/degrees,/sphere,triangles=triangles,$ /kriging,min_points=16,sectors=8,empty_sectors=3,missing=-9999) ; Bytscal the data data_image=bytscl(grid_var,top=top_color,min=dmin_nd,max=dmax_nd) result=where(grid_var eq -9999,count) if count gt 0 then data_image[result]=255 ;gray p1=image(data_image,grid_lon,grid_lat,$ ; I have called this one p1 limit=[llat,llon,ulat,rlon],$ ;map limit vector /current,$ ;Put it in the current open plot window p0 grid_units='degrees',$ center_longitude=((rlon-llon)/2.0)+llon,$ /box_axes,$ label_position=label_pos,$ font_size=12,$ ;bigger font linestyle=2,$ ;grid will be dashed line rgb_table=mytable,$ ;use color table 5 map_projection=map_projection,$ ;map projection position=pos[pnum,*]) p2=mapcontinents(color='white',/hires,thick=2) ;add the continent lines p3=plot([bllon,brlon,brlon,bllon,bllon],[bllat,bllat,bulat,bulat,bllat],/overplot,/data,color='green',thick=3) ; Put on a colorbar c0=colorbar(range=[dmin_nd,dmax_nd],$ ;the colorbar is to match the image labeled p1 orientation=1,position=reform(cbpos[pnum,*]),font_size=12,rgb_table=mycbtable,$ tickdir=1,border_on=1,title='Nd array 1km') t1=text(pos[pnum,0],pos[pnum,3]+dy,'Nd Array 1km',font_size=12) plot_nd_array=grid_var endif else begin plot_nd_array=make_array(n_elements(grid_lon),n_elements(grid_lat),value=-9999) endelse endif ; CLOUD_PHASE 0=missing, 1=clear, 2=liquid, 3=ice, 4=undetermined print,'cloud phase' if 1 eq 1 then begin pnum=3 data_var=cloud_phase data_lat=lat_1km data_lon=colon_1km r=where(data_var ne -9999,c) dmax_phase=max(data_var[r]) dmin_phase=min(data_var[r]) good_lat=data_lat[r] good_lon=data_lon[r] good_var=data_var[r] grid_input,good_lon,good_lat,good_var,xyz,newdata_var,/degree,/sphere,duplicates='First',epsilon=0.01 lon = !radeg * atan(xyz[1,*],xyz[0,*]) & lat = !radeg * asin(xyz[2,*]) ; Triangulate the data ;qhull,good_lon,good_lat,triangles,/delaunay,sphere=s qhull,lon,lat,triangles,/delaunay,sphere=s ;triangulate,good_lon,good_lat,triangles,sphere=s ;grid_var=griddata(good_lon,good_lat,good_var,xout=grid_lon,yout=grid_lat,$ ;grid_var=griddata(lon,lat,newdata_var,xout=grid_lon,yout=grid_lat,$ ; /grid,/degrees,/sphere,triangles=triangles,$ ; /kriging,min_points=15,sectors=8,empty_sectors=3,missing=-9999) grid_var=griddata(lon,lat,newdata_var,xout=grid_lon,yout=grid_lat,$ /grid,/degrees,/sphere,triangles=triangles,$ /nearest_neighbor,missing=-9999) r=where(plot_solar_zenith eq -9999,c) if c gt 0 then grid_var[r]=-9999 ; Bytscal the data phase_table=['light gray','blue','green','gold','red'] data_image=byte(grid_var) r=where(grid_var lt 0,c) if c gt 0 then data_image[r]=0 p1=image(data_image,grid_lon,grid_lat,$ ; I have called this one p1 limit=[llat,llon,ulat,rlon],$ ;map limit vector /current,$ ;Put it in the current open plot window p0 grid_units='degrees',$ center_longitude=((rlon-llon)/2.0)+llon,$ /box_axes,$ label_position=label_pos,$ font_size=12,$ ;bigger font linestyle=2,$ ;grid will be dashed line rgb_table=phase_table,$ ;use color table 5 map_projection=map_projection,$ ;map projection position=pos[pnum,*]) p2=mapcontinents(color='white',/hires,thick=2) ;add the continent lines p3=plot([bllon,brlon,brlon,bllon,bllon],[bllat,bllat,bulat,bulat,bllat],/overplot,/data,color='black',thick=3) ; Put on a colorbar c0=colorbar(range=[dmin_phase,dmax_phase],$ ;the colorbar is to match the image labeled p1 orientation=1,position=reform(cbpos[pnum,*]),font_size=12,rgb_table=phase_table,$ tickdir=1,border_on=1,title='Cloud Phase 1km') t1=text(pos[pnum,0],pos[pnum,3]+dy,'0=miss 1=clear 2=liq 3=ice 4=undet',font_size=14) plot_cloud_phase=grid_var endif p0.save,out_dir+output_file_string+'.temp_re_nd_phase.png',height=pydim end