; $Id: jplot.pro,v 1.3 2024/10/08 19:35:48 nathan Exp $ ; $Log: jplot.pro,v $ ; Revision 1.3 2024/10/08 19:35:48 nathan ; contents of SATPLOT_2.3.tar.gz ; ; Revision 2.3 2024/09/09 00:00:00 penteado ; Updating satplot package to V2.3, added documentation, added local ;+ ;jplot.pro ; ;PURPOSE: ; image brightness plot reveals cme velocity curve. ; ; :Params: ; datetime_start: in, type=string ; Inital date/time, in format YYYYMMDD_HHMMSS ; datetime_end: in, type=string ; Final date/time, in format YYYYMMDD_HHMMSS ; position_angle: in,type=double ; Center position angle to use for map, in degrees. ; delta: in, type=double ; Position angle width for the map, in degrees. ; spacecraft: in, type=string ; Either `a` or `b` to select which STEREO ; ; :Keywords: ; LOCAL: in, optional, default=0 ; If set, search will be done from current directory, into current+'/*_'+spacecraft+'_jmap.png' ; ;METHOD: ; plot narrow angular wedge from sun center to specified outer limit as time series columns in ; cylindrical plot, where xaxis represents time and yaxis represents space and both are linear. ; ;OPTIONS: ; include specified detectors usually COR2/HI_1/HI_2. (EUVI not relevant.) ; time cadence in minutes (hi_1 cadence is nominally 40 minutes, for example, so 40 might be a good choice) ; delta (degrees of angular spread sample) ; ;POSSIBLE FUTURE OPTIONS: ; zoom (and/or outdisplay xsize,ysize or somesuch control?) ; jd start (and or anytim(date,time) maybe?) ; jd end (and/or nsteps maybe?) ; instrument set (default: cor2/hi_1/hi_2, add option for cor1?) ; scale, or MAP_SET LIMIT parameter? ; ;EXAMPLE: ; Choose parameters for time start, time end, position angle, delta and spacecraft: ; IDL> jpredict_movie, '20120307_000000', '20120309_000000', 85, 10, 'a' ; Generate jplot: ; IDL> jplot, '20120307_000000', '20120309_000000', 85, 10, 'a' ; Select points and do curve fit: ; IDL> satplot,'jplot_20120307_000000__20120309_000000__85__10__A.png' ; ;DEPENDENCIES: ; solarsoft with secchi inst ; $secchi must be defined as the directory which contains "lz/" ; ;WRITTEN BY: ; Jeffrey R. Hall (for Paulett Liewer STEREO/SECCHI) ; Jet Propulsion Laboratory ; 2009-2012 ; ; "Copyright 2012, by the California Institute of Technology. ; ALL RIGHTS RESERVED. United States Government Sponsorship ; acknowledged. Any commercial use must be negotiated with the ; Office of Technology Transfer at the California Institute of ; Technology. ; ; This software may be subject to U.S. export control laws. ; By accepting this software, the user agrees to comply with ; all applicable U.S. export laws and regulations. User has ; the responsibility to obtain export licenses, or other ; export authority as may be required before exporting such ; information to foreign countries or providing access to ; foreign persons." ;- PRO JPLOT, datetime_start, datetime_end, position_angle, delta, spacecraft, LOCAL=local if size(local,/type) eq 0 then local=0 zoom = 3 cadence_minutes = 30 jd_start = (ANYTIM2JD(datetime_start)).(0)+(ANYTIM2JD(datetime_start)).(1) jd_end = (ANYTIM2JD(datetime_end)).(0)+(ANYTIM2JD(datetime_end)).(1) spacecraft = strlowcase(spacecraft) ;;Test on remote laptop. ;tcsh ;setenv secchi {$HOME}/secchi/net/corona/secchi/flight/ ; jd_start = JULDAY(8,31,2007,20,0,0) ; jd_end = JULDAY(9,1,2007,4,0,0) jd=jd_start nsteps=ROUND((jd_end - jd_start) * (24. * (60. / cadence_minutes))) xsize=nsteps ysize=360*zoom ; WINDOW,1,XSIZE=xsize,YSIZE=ysize ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Possible future modifications: ; ; 1. MAKE SURE ORIGIN IS AT BOTTOM ; REVERSE parameter in either map_set or map_patch, or some other technique ; ; 2. CONSTRUCT X-AXIS AND Y-AXIS OF PLOT SPACE, POSITION JPLOT IN PLOT SPACE ; Unset NOBORDER, XMARGIN, YMARGIN, allow them to default to plot space and take advantage of that ; ; 3. BUILD GUI FOR THE FOLLOWING CONTROL VARIABLES: ; position_angle = 75 ; delta = 3 ; zoom = 3 ; cadence_minutes = 40 ; spacecraft = 'b' ; jd_start = JULDAY(9,1,2007,0,0,0) ; jd_end = JULDAY(9,31,2007,0,0,0) ; instrument set (default: cor2/hi_1/hi_2, add option for cor1) ; scale, or MAP_SET LIMIT parameter (IS THIS THE SAME AS ZOOM?) ; ; 4. OPTIONALLY EMPLOY ALTERNATE ALGORITHM ; Algorithm 1: cylindrical mapping ; Algorithm 2: corden-off box sampling (see test1_jplot.pro) ; ; 5. ESTIMATE DISK SPACE ; PNG difference images from SREM_MOVIE ; PNG + FTS maps + jplots ; ; 6. ESTIMATE RUN TIME ; Run one jplot column to get time? ; Possibly add progress bars ; - build lists ; - SREM_MOVIE difference images ; - create jplots ; ; 7. GRAPHICALLY SHOW ESTIMATES OF position_angle, delta, zoom ; ; 8. POSSIBLY REPLACE CONGRID WITH MEAN ; test to see if it gives same result. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; jplot=BYTARR(xsize,ysize) column=MAKE_ARRAY(ysize,TYPE=SIZE(slice,/TYPE)) dates=STRARR(nsteps) times=STRARR(nsteps) ;---------------------------------------------------------- ; Generate lists of dates, times, HI_1 filenames, and HI_2 filenames. ;---------------------------------------------------------- FOR timeframe = 0L, nsteps-1 DO BEGIN ;---------------------------------------------------------- ; Manage the date format. ;---------------------------------------------------------- CALDAT,jd,mon,day,year,hour,minute,second IF mon LT 10 THEN mon='0'+STRTRIM(mon,2) ELSE mon=STRTRIM(mon,2) IF day LT 10 THEN day='0'+STRTRIM(day,2) ELSE day=STRTRIM(day,2) IF hour LT 10 THEN hour='0'+STRTRIM(hour,2) ELSE hour=STRTRIM(hour,2) IF minute LT 10 THEN minute='0'+STRTRIM(minute,2) ELSE minute=STRTRIM(minute,2) second = FIX( second ) IF second LT 10 THEN second='0'+STRTRIM(second,2) ELSE second=STRTRIM(second,2) dates[timeframe] = STRTRIM( year, 2 ) + mon + day times[timeframe] = hour + minute + second ;---------------------------------------------------------- ; Cadence, in minutes. ;---------------------------------------------------------- jd = jd + ( ((cadence_minutes / 60.0d) / 24.) ) ENDFOR ; One more date calculation for the end-date in the PNG filename. CALDAT,jd,mon,day,year,hour,minute,second IF mon LT 10 THEN mon='0'+STRTRIM(mon,2) ELSE mon=STRTRIM(mon,2) IF day LT 10 THEN day='0'+STRTRIM(day,2) ELSE day=STRTRIM(day,2) IF hour LT 10 THEN hour='0'+STRTRIM(hour,2) ELSE hour=STRTRIM(hour,2) IF minute LT 10 THEN minute='0'+STRTRIM(minute,2) ELSE minute=STRTRIM(minute,2) second = FIX( second ) IF second LT 10 THEN second='0'+STRTRIM(second,2) ELSE second=STRTRIM(second,2) end_date = STRTRIM( year, 2 ) + mon + day end_time = hour + minute + second FOR frame = 0L, nsteps-1 DO BEGIN ;if frame mod 100 eq 0 then begin ; print,'Creating jplot columns. Frame ', strtrim(frame,2), ' of ', strtrim(nsteps,2),' ',dates[frame],'_',times[frame] ;l print,'file_search(get_closest_jmap_filename( dates[frame], times[frame], ',spacecraft,' )) = ',file_search(get_closest_jmap_filename( dates[frame], times[frame], spacecraft, LOCAL=local )) ;endif jmap_filename=file_search(get_closest_jmap_filename( dates[frame], times[frame], spacecraft, LOCAL=local )) print,jmap_filename map=read_png(jmap_filename) slice=map[position_angle*zoom:position_angle*zoom+delta*zoom,*] ; slice=REVERSE(slice,2) ; column=CONGRID(slice,1,ysize,CUBIC=-0.5) FOR row=0,ysize-1 DO column[row]=MEAN(slice[*,row]) jplot[frame,*]=column ENDFOR ;write_png,'jplot_none.sav',jplot ; jplot2=bytscl(dev_filter2(jplot,1.0)) ;write_png,'jplot_1.0.sav',jplot2 zpad='' ; png_filename='jplot_' + dates[0]+'_'+times[0] + '__' + dates[nsteps-1]+'_'+times[nsteps-1] + '__' + $ png_filename='jplot_' + dates[0]+'_'+times[0] + '__' + end_date+'_'+end_time + '__' + $ STRTRIM(position_angle,2) + '__' + STRTRIM(delta,2) + '__' + STRUPCASE(spacecraft) + '.png' print PRINT,'execute this: ' PRINT,'satplot,''',png_filename,'''' WRITE_PNG, png_filename, jplot END ;plot,findgen(10),findgen(10) ;tv_xs=!P.CLIP[0]+1 ;tv_ys=!P.CLIP[1]+1 ;image_xsize=!P.CLIP[2]-!P.CLIP[0]-1 ;image_ysize=!P.CLIP[3]-!P.CLIP[1]-1 ;tv,bindgen(image_xsize,image_ysize),tv_xs,tv_ys ;plot,findgen(10),findgen(10),/noerase