;+ ;Purpose: A crib detailing how to plot 2-D slices through THEMIS ESA and SST ; particle distributions using thm_part_dist_array, thm_part_slice2d, ; and plot_part_slice2d ; ; Run "thm_ui_slice2d" on the IDL console to use for the GUI version. ; (Also part of the Analysis menu on the main THEMIS GUI) ; ; ;QUICK DESCRIPTION: Particle distributions from the ESA and SST are used ; to generate 2D slices of the particles’ three-dimensional velocity ; distributions. The slices show contoured particle data (in counts ; or other units) plotted against their Cartesian velocities. ; If the time range requested covers multiple distributions then ; the data are averaged. ; ; ;TYPE: There are three methods of producing velocity slices: ; ; Geomtric (default): ; Exact method showing the bounds of all bins intersecting the slice plane. ; Values are averaged in cases of overlapping bins or when the slice plane ; is coplanar with a bin's boundary. ; ; 2D Interpolation (from thm_esa_slice2d, keyword:/TWO_D_INTERP): ; Datapoints within the specified range are projected onto the slice plane ; and linearly interpolated onto a regular grid. The range may be specified ; by theta value (defualt) or z-axis value (in km/s) with respect to the ; slice plane's coordinates (see ROTATION and COORD keywords). ; ; 3D Interpolation (keyword:/THREE_D_INTERP): ; The entire 3-dimensional distribution is linearly interpolated onto a ; regular 3d grid and a this slice is extracted. This method works best with dense data. ; Note: - Interpolation may occur across data gaps or areas with recorded zeroes ; - Can be slow if slice resolution is high (>250) ; ; ;KEYWORD INFO: ; ; COORD: Available coordinates (DSL by default): ; 'DSL','GSM','GSE' ; ; ROTATION: The rotation keyword further specifies the coordinates system used ; to create a slice. A description of each new set of coordinates ; is given below. Some rotations are invariant of the coordinates ; specified by COORD (BV,perp), other are not (xy,perp_xy). By default ; the slice will be cut along the x-y plane of the given coordinates. ; ; Field alligned coordinates (FAC) options can be used in stead of the ; rotations listed below. See thm_fac_matrix_make for descriptions of each. ; ; 'BV': The x axis is parallel to the B field; the bulk velocity defines the x-y plane. ; 'BE': The x axis is parallel to the B field; the B x V(bulk) vector defines the x-y plane. ; 'xy': The x axis is V_x and the y axis is V_y. (No rotation/default) ; 'xz': The x axis is V_x and the y axis is V_z. ; 'yz': The x axis is V_y and the y axis is V_z. ; 'xvel': The x axis is V_x; the y axis is defined by the bulk velocity. ; 'perp': The x axis is the bulk velocity projected onto the plane normal to the B field; y is B x V(bulk) ; 'perp_xy': Geometric xy coordinates projected onto the plane normal to the B field. ; 'perp_xz': Geometric xz coordinates projected onto the plane normal to the B field. ; 'perp_yz': Geometric yz coordinates projected onto the plane normal to the B field. ; ; Valid FACs: ; 'xgse': The x axis is the projection of the GSE x-axis ; 'ygsm': The y axis is the projection of the GSM y-axis ; 'zdsl': The y axis is the projection of the DSL z-axis ; 'RGeo': The x is the projection of radial spacecraft position vector (GEI) ; 'mRGeo': The x axis is the projection of the negative radial spacecraft position vector (GEI) ; 'phiGeo': The y axis is the projection of the azimuthal spacecraft position vector (GEI), positive eastward ; 'mphiGeo': The y axis is the projection of the azimuthal spacecraft position vector (GEI), positive westward ; 'phiSM': The y axis is the projection of the azimuthal spacecraft position vector in Solar Magnetic coords ; 'mphiSM': The y axis is the projection of the negative azimuthal spacecraft position vector in Solar Magnetic coords ; ; ; ; UNITS: Available units (DF by default): ; 'Counts', 'DF', 'Rate', 'CRate', 'Flux', 'EFlux' ; ; ;CONTAMINATION REMOVAL: See the documentation in THM_PART_DIST_ARRAY for options on ; contamination removal. The contamination/background removal keywords used with ; THM_PART_GETSPEC and THM_PART_MOMENTS may be used in calls to THM_PART_DIST_ARRAY. ; Also see THM_CRIB_SST_CONTAMINATION and THM_CRIB_ESA_BGND_REMOVE. ; ; ; ;OTHER: A general overview of velocity slices can be found the THEMIS User's guide. ; Detailed information on keywords and usage can be found in the documentation for: ; thm_part_slice2d.pro (main slices routine) ; plot_part_slice2d.pro (slices plotting routine) ; thm_part_dist_array.pro (particle data load routine) ; ; ;NOTE: A second crib detailing how to export multiple slices at once ; is at the bottom of this document. ; ;- PRO thm_crib_part_slice2d ;=========================================================== ; Load Data ;=========================================================== ; Set probe and time range probe = 'b' day = '2008-02-26/' start_time = time_double(day + '04:54:00') end_time = time_double(day + '04:54:30') ; Pad time range to ensure enough data is loaded trange = [start_time - 90, end_time + 90] ; Set the time slice_time = start_time ; time at which to calculate the slice timewin = 30. ; the window over which data will be averaged ; Load magnetic field and l2 velocity data ; -B data is required for all rotations other than xy/yz/xz. ; -Velocity data is required for BV, BE, perp, and xvel. If velocity ; data is not loaded explicitly it will be automatically calculated ; from the raw distribution. thm_load_fgm, probe=probe, datatype = 'fgs', level=2, coord='dsl', trange=trange thm_load_esa, probe=probe, datatype = 'peib_velocity_dsl', trange=trange mag_data = 'thb_fgs_dsl' vel_data = 'peib_velocity_dsl' ; Create array of ESA particle distributions ; -Background removal options can be used inthis call (examples later) ; -The MAG_DATA and VEL_DATA keywords can be set to valid tplot variable ; names to add the respective quantities to the returned data structures. ; This avoids having to set the keywords later when generating slices. peib_arr = thm_part_dist_array(probe=probe, type='peib', trange=trange) ; -Specify b-field and velocity data variables to be used. These variables ; will be used later to orient some velocity/field alligned cuts. ;peib_arr = thm_part_dist_array(probe=probe, type='peib', trange=trange, $ ; mag_data=mag_data, $ ; vel_data=vel_data) ; Create array of SST particle distributions ; -Contamination removal options can be used in this call. See ; thm_crib_sst_contamination for available options. Any contamination ; keyword used with thm_part_moments or thm_part_getspec can also ; be used here. ; -The /SST_CAL keyword can be added to use the beta sst calibrations psif_arr = thm_part_dist_array(probe=probe, type='psif', trange=trange) ; -Use sun removal options ;psif_arr = thm_part_dist_array(probe=probe, type='psif', trange=trange, $ ; method_sunpulse_clean = 'median', mask_remove = .99) ; -Use BETA SST calibrations ;psif_arr = thm_part_dist_array(probe=probe, type='psif', trange=trange, /sst_cal) ;=========================================================== ; Basic Slices ;=========================================================== ; Default geometric ESA slice ; ----------------- ; -A regular grid of points is aligned with the data and each point ; on the grid receives the value of the bin it inhabits. This allows ; bin boundaries to be prepresented on a plot at high resolutions. ; However, data can be left out if the resolution is too low. ; This is most likely to happen for low energy (velocity) bins whose ; sizes are small in the final plot. Setting a maximum energy limit ; can effectively "zoom in" on plot's center to regain the lost ; resolution. ; -By default this method uses resolution of 500 points/direction. ; If the performance slows this number should be reduced, but be ; aware of the aforementioned loss of low velocity bins. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ part_slice=part_slice ; slice data ; Plot plot_part_slice2d, part_slice stop ; ESA slice using 2d interpolation ; ----------------- ; -The 2d interpolation method is (nearly) identical to that ; of thm_esa_slice2d. This method projects all data within a ; specified angle onto the slice plane and performs a linear ; interpolation. The default angle range is [-20,20] ; -By default this method uses a resolution of 51 points per side ; and a smoothing width of 3 points ; -Smoothing is performed with a Gaussian convolution (Gaussian blur) ; over the specified number of points in both dimensions. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ /two_d_interp, $ ;2d interpolation keyword part_slice=part_slice ; Plot plot_part_slice2d, part_slice stop ; Higher resolution 2d interpolation ; ----------------- ; -This example uses higher resolution and wider smoothing width than ; the previous example. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ /two_d_interp, $ resolution = 150, $ ;slice with 150x150 points smooth = 5, $ ;smooth over 5 points in each direction part_slice=part_slice plot_part_slice2d, part_slice stop ; ESA slice using 3d interpolation ; ----------------- ; -Performs a three dimensional interpolation on the original ; data then extracts a two dimentional slice. ; -By default this will use a resolution of 150 points/dimension ; and no smoothing. ; -This operation can be computationally expensive and memory ; intensive. Using higher resolutions will quickly slow this ; procedure and deplete free memory. Resolutions lower than ; 300 are recommended. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ /three_d_interp, $ ;3d interp keyword part_slice=part_slice plot_part_slice2d, part_slice stop ; Lower resolution 3d interpolation ; ----------------- ; -This example uses 3d interpolation with lower resolution ; and smoothing set. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ /three_d_interp, $ ;3d interp keyword resolution=80, $ ;slice with 80x80 points smooth=5, $ ;smooth over 5 points in each direction part_slice=part_slice plot_part_slice2d, part_slice ;=========================================================== ; Slice Options ;=========================================================== ; Slice Orientation Overview: ; ---------------- ; By default slices will be taken along the xy plane of the specified coordinates system, DSL. ; The COORD keyword allows for GSE and GSM coordinates to be used. The rotation keyword ; specifies unique coordinates and field aligned coordinates (described at the top of this document). ; Some unique coordinate options are defined with respect to other coordinates, therefore these two ; keywords can be used in conjuction. The slice is then taken along the xy plane of the coordinates ; specified by COORD and/or ROTATION. ; A custom orienation can be set by using the SLICE_NORM and SLICE_X keywords to specify the ; slice plane's normal and x axis, respectively. These vectors are interpreted as being in the ; coordinates set up by COORD/ROTAION. ; ; Brief Examples: ; -The usual 'BV' roation but swaping the x and y axes ; rotation='bv', slice_norm=[0,0,1], slice_x=[0,1,0] ; ; -Slice along the GSM xz plane ; coord='gsm', rotation='xz' ; or ; coord='gsm', slice_norm=[0,1,0], slice_x=[1,0,0] ; SST slice in GSM coordinates ; ----------------- ; -DSL coordinates are used by default, set the COORD keyword ; to use GSM or GSE ; -By default slices are taken along the xy plane of the coordinate ; system. Set the ROTATION keyword to specify a different ; orientation (options for this keyword are listed at the top of ; this document). thm_part_slice2d, psif_arr, slice_time=slice_time, timewin=timewin, $ COORD='GSM', $ ; GSM coordinates rotation='xz', $ ; slice along xz plane in GSM part_slice=part_slice plot_part_slice2d, part_slice stop ; ESA slice using field aligned coordinates (FAC) ; ----------------- ; -Field alligned orientation are available with the ROTATION keyword. ; -This example uses field alligned coordinates with 'rGeo' as the ; OTHER_DIM option: (z-axis parallel to the B field, x in the ; direction of the positive radial position vector, y points eastward). ; For other field aligned options see the ROTATION options at the ; top of this document. ; -By default the slice will be cut along the x-y plane in the ; specified FAC. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ rotation='rGeo', $ ; FAC list/descriptions at top of crib mag_data=mag_data, $ ; must pass in tplot variable for FAC part_slice=part_slice plot_part_slice2d, part_slice stop ; ESA slice using field aligned coordinates & custom orientation ; ----------------- ; -This example uses the same coordinates as the previous, but aligns ; the slice plane differently. The slice's x-axis is now parallel to ; the B field and the y-axis is in the direction of the positive ; radial position vector. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ rotation='rGeo', $ ; FAC list/descriptions at top of crib mag_data=mag_data, $ ; must pass in tplot variable for FAC slice_norm=[0,1,0], $ ;slice will be in x-z plane slice_x=[0,0,1], $ ;slice will use z (bfield) as x-axis part_slice=part_slice plot_part_slice2d, part_slice stop ; Field/Velocity aligned ESA slice ; ----------------- ; -The 'BV' rotation will set the x-axis parallel to the B field, and ; the y-axis will be in the direction of the bulk velocity vector. ; -B field data may be specified here OR when loading the data ; (thm_part_dist_array). The velocity will be calculated automatically ; if the VEL_DATA keyword is not set here or when loading the data. thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ rotation='bv', $ ; slice along xz plane in GSM mag_data=mag_data, $ ; specify mag data for rotation resolution=90, smooth=5, $ ; low resolution with smoothing part_slice=part_slice plot_part_slice2d, part_slice stop ; Field/Velocity aligned ESA slice with averaging ; ----------------- ; -Identical to the previous example, but with averaging added ; -Setting the AVERAGE_ANGLE keyword will average all data within ; the specified angle from the slice plane about the x-axis. ; ; **NOTE: Averaging may take up to 60+ seconds with full resolution (500) ; this example uses lower resolution to decrease computation time. ; (should take < 10 seconds) thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ rotation='bv', $ ; slice along xz plane in GSM mag_data=mag_data, $ ; specify mag data for rotation average_angle=[-30,30], $ ; min/max to average about x resolution=90, smooth=5, $ ; low resolution with smoothing part_slice=part_slice plot_part_slice2d, part_slice stop ; Field/Velocity aligned SST slice ; -------------- ; -SST data using 'BV' rotation thm_part_slice2d, psif_arr, slice_time=slice_time, timewin=timewin, $ rotation='bv', $ ; use BV rotation, described above mag_data=mag_data, $ ; specify mag data for rotation resolution=120, smooth=5, $ ; for comparison with next plot part_slice=part_slice plot_part_slice2d, part_slice stop ; Field/Velocity aligned SST slice with averaging ; -------------- ; -This is idententical to the previous example but averages over ; all planes within 45 degrees of the slice plane thm_part_slice2d, psif_arr, slice_time=slice_time, timewin=timewin, $ rotation='bv', $ ; use BV rotation, described above mag_data=mag_data, $ ; specify mag data for rotation average_angle=[-90,90], $ ; min/max to average about x resolution=120, smooth=5, $ part_slice=part_slice plot_part_slice2d, part_slice stop ; Custom aligned SST slice ; ----------------- ; -The SLICE_NORM keyword specifies the normal of the slice plane ; in the given coordinates/rotation, this example will plot a ; slice normal to <1,0,5> in GSE coordinates. If the ROTATION ; keyword is also set SLICE_NORM will be interpreted in the ; coordinates defined by that rotation. thm_part_slice2d, psif_arr, slice_time=slice_time, timewin=timewin, $ COORD='GSE', $ ; GSE coordinates slice_norm = [-1,0,5.], $ ; slice plane normal part_slice=part_slice, fail=fail plot_part_slice2d, part_slice stop ; Set minimum counts threshold ; ----------------- ; -Bins whose counts fall below a specifed value can be masked ; when creating slices. The bins are removed from the calculation ; BEFORE averaging, so sub-threshold values can still occur in ; the final plot. thm_part_slice2d, psif_arr, slice_time=slice_time, timewin=timewin, $ COORD='GSE', $ ; GSE coordinates slice_norm = [-1,0,5.], $ ; slice plane normal count_threshold = 2, $ ; mask bins with less than 2 counts part_slice=part_slice, fail=fail plot_part_slice2d, part_slice stop ; Plot multiple distributions ; ----------------- ; -Up to four distribution arrays can be used to create a ; single slice using the geometric method. This example ; combines ESA and SST ion distributions. thm_part_slice2d, psif_arr, peib_arr, $ ; pass in up to four distribution arrays slice_time=slice_time, timewin=timewin, $ COORD = 'GSE', $ ; GSE coords erange = [0,200000], $ ; limit energy range to exclude ; higher energies part_slice=part_slice ; Plot plot_part_slice2d, part_slice stop ;=========================================================== ; Slice Options Overview ; **This section only contains documentation, for more ; examples scroll down to the plotting options section** ;=========================================================== ; Method Specific Defaults ; (Keywords that are set by default for each method) ;------------------------- ; ; Geometric (default method) ; resolution = 500. ; ; 2D Interpolation ; resolution = 51. ; smooth = 3 ; thetaRange = [-20,20.] ; ; 3D Interpolation ; resolution = 150. ; Other Options ; (Examples of the all keywords to thm_part_slice2d) ;-------------- ;two_d_interp = 1 ; use 2D interpolation method ; (see description at the top of this document) ;three_d_interp = 1 ; use 2D interpolation method ; (see description at the top of this document) ;coord = 'GSM' ; use GSM/GSE to use those coordinates ; (see description at the top of this document) ;rotation = 'BE' ; use BE rotation to orient slice ; (see description at the top of this document) ;slice_norm = [1,0,0] ; cut the slice perpendicular to the x-axis, and ;slice_x = [0,0,1] ; use the z-axis as the slice's x-axis ; -both vectors are interpreted as being in the coordinates ; defined by COORD and/or ROTATION ; -SLICE_X is ignored if the normal is not specified ; -the projection of SLICE_X is used if it is not ; already in the slice plane ;erange = [0,5000] ; set this keyword to the desired energy limits in eV ; data outside this range will not be plotted ;units = 'eflux' ; set this keyword to change the units used ('DF' is default) ; 'Counts', 'DF', 'Rate', 'CRate', 'Flux', 'EFlux' ;count_threshold = 1 ; set to 1 to remove any bins that fall below one-count after averaging ;smooth = 5 ; apply gaussian smoothing to slice (number specifies window size in points) ;center_time = 1 ; set this keyword to make SLICE_TIME the center of the time window ;resolution = 80 ; set this keyword to change the resolution of the final plot ;regrid = [64,32,48] ; (2d/3d inerpolation only) ; regrid the data before generating the slice, data will be ; interpolated using the nearest neighbor to 64 x 32 x 48 ; points in phi, theta, and energy respectively stop ;=========================================================== ; Ploting Options ;=========================================================== ; Create array of ESA particle distributions ; - use GET_SUN_DIRECTION keyword to load sun direction vector ; (used in example below) peib_arr = thm_part_dist_array(probe=probe, type='peib', trange=trange, $ /get_sun_direction) ; Get a basic x-y plane ESA slice in DSL thm_part_slice2d, peib_arr, slice_time=slice_time, timewin=timewin, $ resolution = 65, smooth = 5, $ part_slice=part_slice ; Plot the slice plot_part_slice2d, part_slice stop ; Limit the x and y axes ; ----------------- plot_part_slice2d, part_slice, xrange = [1500.,-1500], yrange = [1500.,-1500] stop ; Change the range of the color contours and increase the number of ; levels for smoother gradients (default is 60 levels) ; ----------------- plot_part_slice2d, part_slice, range = [1.E-14,1.E-8], levels = 120 stop ; Add contour lines with annotations to the previous plot ; ----------------- plot_part_slice2d, part_slice, range = [1.E-14,1.E-8], levels = 120, $ olines = 8, /clabels stop ; Change other options ; -x/y = 0 is shown with dashed lines by default ; -instrument or current energy limits are plotted by default ; -bulk velocity projection plotted by default with red line ; -sun direction denoted by solid black line, the length is ; proportional to the projection's magnitude (if the vector is ; in the slice plane it will be drawn to the instrument's limit) ; **sun direction requires keyword to thm_part_dist_array ; (called above) to load state data ; ----------------- plot_part_slice2d, part_slice, $ ; plotbulk = 0, $ ;turn off bulk velocity projection plotaxes = 0, $ ;turn off x/y=0 ecircle = 0, $ ;turn off E limit circles sundir = 1 ;plot sun direction stop ; Increase font size ; -CHARSIZE is treated as a multiplier for font size, 1 being the default ; ----------------- plot_part_slice2d, part_slice, charsize = 1.6 stop ; Set custom main title, x-axis title, and y-axis titles ; ----------------- plot_part_slice2d, part_slice, $ title = 'HELLO WORLD!', $ xtitle='I''m the x-axis!', ytitle='I''m the y-axis!' stop ; Set custom number of ticks for each axis ; -set major ticks with [XYZ]TICKS ; -set minor ticks with [XY]MINOR ; ----------------- plot_part_slice2d, part_slice, $ xticks=7, yticks=15, zticks=22, $ xminor=4, yminor=2 stop ; Increase the size of the previous example ; -plot size is taken in pixels, default is 500 ; ----------------- plot_part_slice2d, part_slice, $ xticks=7, yticks=15, zticks=22, $ xminor=4, yminor=2, $ plotsize = 750 stop ; Set custom annotation options ; -set [XYZ]STYLE to 0,1,2 for auto/decimal/scientific notation respectively ; - use[XYZ]PRECISION to controls how many significant figures ; to display. For auto-format the precision determins when ; scientific notation will be used instead of decimal ; ; -this example demonstrates decimal format for the x axis ; ----------------- plot_part_slice2d, part_slice, $ xticks = 4, $ ;custom ticks for non-round #s xprecision = 8, $ ;8 sig figs xstyle=1 ;use decimal format stop ; Set custom annotation options (cont.) ; -use scientific notation for the x/y axes ; ----------------- plot_part_slice2d, part_slice, $ xprecision = 2, $ ;2 sig figs yprecision = 2, $ ;2 sig figs xstyle=2, $ ;use scientific notation ystyle=2, $ ;use scientific notation stop ; Set custom annotation options (cont.) ; This example demonstrates adding precision to z axis, ; and supressing minor ticks on the x/y axes ; ----------------- plot_part_slice2d, part_slice, $ xminor = 0, $ ;supress minor ticks yminor = 0, $ ;supress minor ticks zprecision = 6 ;6 sig figs for z annotations stop ;=========================================================== ; Plotting Options overview: ; **This section only contains documentation, for more ; examples scroll down to the plotting options section** ;=========================================================== ; ;levels = 120 ; change the number color contours, default is 60 ;olines = 8 ; change the number of contour lines, default is 0 ;range = [1.E-14,1.E-8] ; limit data range for plotting ;xrange = [1500.,-1500] ; specify x-range to plot ;yrange = [1500.,-1500] ; specify y-range to plot ;sundir = 1 ; plot sun direction (may load STATE data), off by default ;plotaxes = 0 ; turn off dashed lines at x,y=0, on by default ;ecircle = 0 ; turn off plotting of energy limits, on by default ;plotbulk = 0 ; turn off plotting bulk velocity projection on the slice plane, ; (on by default) ;logplot = 0 ; use a linear z-axis ;clabels = 1 ; annotate contour lines ;plotsize = 700 ; change size of plot of screen, default is 500 ;charsize = 1.20 ; set text to 120% size ;xticks = 8 ; change # of x tick marks ;yticks = 8 ; change # of y tick marks ;zticks = 12 ; change # of z tick marks ;export = '/home/my_dir/filename' ; automatically export plot, png used by default ;eps = 1 ; export to postscript END ;=========================================================== ; Multiple Slices ;=========================================================== ;+ ; ; A Secondary Crib: Create Multiple Slices and Export: ; ; ;- PRO thm_crib_part_slice2d_multi ; Choose output location: outputfolder='C:\THEMIS\slice_crib\' ;Modify and uncomment this line if you're using Windows ;outputfolder='/THEMIS/slice_crib/' ;Modify and uncomment this line if you're using Mac/Unix/Linux ; Load Data ;----------- ; Set time range day = '2008-02-26/' start_time = time_double(day + '04:50:00') end_time = time_double(day + '04:55:00') ; pad time range to ensure enough data is loaded trange=[start_time - 90, end_time + 90] ; set data types probe = 'b' type = 'pseb' ; This example will use geometric coordinates so skip loading of mag & velocity data ;thm_load_fgm, probe=probe, datatype = 'fgh', level=2, coord='dsl', trange=trange ;thm_load_esa, probe=probe, datatype = 'peeb_velocity_dsl', trange=trange ; Create array of SST particle distributions ; -use SST contamination removal dist_arr = thm_part_dist_array(probe=probe,type=type, trange=trange, $ method_sunpulse_clean = 'median', mask_remove = .99) ;Set Options ;------------ timewin = 60. ; set the time window for each slice incriment = 30. ; time incriment for next slice's start coord = 'gsm' ; GSM coordinates slice_norm = [0,1,0] ; slice along x-z plane slice_x = [0,0,1] ; use z-axis as the slice's x-axis erange = [0,5e5]; limit energy range range = [2.2e-27, 2.2e-20] ; plot using fixed range ; Use loop to create multiple slices and export plots ;---------------------------------------------------- slice_time = start_time while slice_time lt end_time do begin ;Create slice thm_part_slice2d, dist_arr, slice_time=slice_time, timewin=timewin, $ coord=coord, rotation=rotation, erange=erange, $ slice_norm=slice_norm, slice_x=slice_x, $ part_slice=part_slice, $ fail=fail ; Check for errors, ; the FAIL variable will contain a string message if something goes wrong if keyword_set(fail) then begin print, 'An error occured while creating the slice at '+time_string(slice_time)+':' print, fail endif ;create filename for image outputfile = outputfolder + time_string(format=2,slice_time) + '_th'+probe+'_'+type ;Call plotting procedure plot_part_slice2d, part_slice, range=range, $ ;constant range ; /eps, $ ;set this keyword to export to postscript export=outputfile ;automatically export slice_time += incriment ;increment time endwhile END