Commit 1603536467b3729b111be34f5bade9218cbb3adb

Authored by Benjamin Renard
0 parents

First commit

Showing 1172 changed files with 134559 additions and 0 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 1172 files displayed.

.gitignore 0 → 100644
  1 +++ a/.gitignore
... ... @@ -0,0 +1,9 @@
  1 +AMDA_IHM/data/
  2 +AMDA_IHM/generic_data/EPNResources/*.xml
  3 +AMDA_IHM/generic_data/LocalData/
  4 +AMDA_IHM/generic_data/Param/*.xml
  5 +AMDA_IHM/generic_data/RemoteData/
  6 +AMDA_IHM/generic_data/Statistics/
  7 +AMDA_IHM/generic_data/newKernelDDBase/
  8 +AMDA_IHM/js/lib/ext
  9 +AMDA_IHM/help/simu/simu*
... ...
.project 0 → 100644
  1 +++ a/.project
... ... @@ -0,0 +1,11 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>AMDA-NG4</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + </buildSpec>
  9 + <natures>
  10 + </natures>
  11 +</projectDescription>
... ...
amda_plus/README 0 → 100644
  1 +++ a/amda_plus/README
... ... @@ -0,0 +1,12 @@
  1 +These idl codes should be added to old AMDA installation in order AMDA-NG to work.
  2 +
  3 +Copy
  4 +
  5 + amdalib/* to /AMDALIB/lib
  6 + ddlib/* to /DDLIB/lib
  7 + predefined/* to pro specific for amda-ng don't copy; keep as it is
  8 + pro/* to pro specific for amda-ng don't copy; keep as it is
  9 + templates/* - pro specific for amda-ng don't copy; keep as it is
  10 +
  11 +Normally there should be no interference between old AMDA and AMDA-NG (TO CHECK)
  12 +So AMDA installation could be used with old AMDA as well as with AMDA-NG
0 13 \ No newline at end of file
... ...
amda_plus/amdalib/a2000.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/a2000.pro
... ... @@ -0,0 +1,64 @@
  1 +pro a2000, Time, Orbit
  2 +
  3 + StepDefaut = 3600.0
  4 + FillValue = -1.e31
  5 + Number = N_elements(Time)
  6 + Bgsm = fltarr(3)
  7 + xyz = fltarr(3)
  8 +
  9 +
  10 + num31 = where(Orbit[0,*] ne FillValue, Index31)
  11 + if (Index31 le 0) then return
  12 +
  13 + Time = Time[num31]
  14 + Orbit = Orbit[*,num31]
  15 +
  16 + ; StepAve = (Time[Number-1] - Time[0])/20.0 > StepDefaut
  17 + StepAve = StepDefaut;
  18 + TimeIntDst = StepAve > 3600.;
  19 + TimeIntDstS = call_external(!DDLIB + 'DD_idl.so','GetTime', double(TimeIntDst), /S_Value)
  20 + StepAveS = call_external(!DDLIB + 'DD_idl.so','GetTime', double(StepAve), /S_Value)
  21 +
  22 +
  23 + bm = fltarr(3);
  24 + bdd = fltarr(3,7);
  25 + UT = lonarr(7);
  26 +
  27 + p = [2., 1., 1., 1., 1., 1., 1.];
  28 + result = call_external(!PROJLIB + 'a2012fa_idl.so', 'pstatus', p);
  29 + for TimeCurr = Time[0], Time[Number-1], double(StepAve) do begin
  30 +
  31 + numOrb = where((Time - TimeCurr LT StepAve) AND (Time - TimeCurr GE 0.0), IndexOrb)
  32 + if (IndexOrb LE 0) then continue
  33 +
  34 + params = sw_monitor_a99_(TimeCurr,StepAve,Orbit[*,numOrb[IndexOrb/2]])
  35 + STime = call_external(!DDLIB + 'DD_idl.so','GetTime', double(TimeCurr+StepAve/2.0), /S_Value)
  36 +
  37 + AE = ae_(STime, StepAveS, TimeDst, RetSize, Sampling, /CLOSE);
  38 + AL = RetSize GT 0 ? mean(AE[1,*]) : -100.0;
  39 +
  40 + Dst = dst_(STime, TimeIntDstS, TimeDst, RetSize, Sampling, /CLOSE);
  41 + Dst_av = RetSize GT 0 ? mean(Dst) : -10.;
  42 + ro = params[0];
  43 + v = params[1];
  44 + bimf =params[2:4];
  45 +
  46 + for i = 0, IndexOrb - 1 do begin
  47 + res = call_external(!DDLIB + 'DD_idl.so','GetGavTime', UT, double(TimeCurr+StepAve/2.0));
  48 +
  49 + x = Orbit[*,numOrb[i]];
  50 +
  51 + result = call_external(!PROJLIB + 'a2012fa_idl.so', 'model', $
  52 + UT[0], UT[1], UT[2], float(UT[3]),$
  53 + ro, v, bimf, Dst_av, AL, $
  54 + x, bm, bdd);
  55 + if bm[0] eq 0.0 then bm(*) = FillValue ;
  56 + Orbit[*,numOrb[i]] = bm;
  57 + endfor
  58 + endfor
  59 +
  60 + return
  61 +end
  62 +
  63 +
  64 +
0 65 \ No newline at end of file
... ...
amda_plus/amdalib/a2000omni.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/a2000omni.pro
... ... @@ -0,0 +1,64 @@
  1 +pro a2000omni, Time, Orbit
  2 +
  3 + StepDefaut = 3600.0
  4 + FillValue = -1.e31
  5 + Number = N_elements(Time)
  6 + Bgsm = fltarr(3)
  7 + xyz = fltarr(3)
  8 +
  9 +
  10 + num31 = where(Orbit[0,*] ne FillValue, Index31)
  11 + if (Index31 le 0) then return
  12 +
  13 + Time = Time[num31]
  14 + Orbit = Orbit[*,num31]
  15 +
  16 + ; StepAve = (Time[Number-1] - Time[0])/20.0 > StepDefaut
  17 + StepAve = StepDefaut;
  18 + TimeIntDst = StepAve > 3600.;
  19 + TimeIntDstS = call_external(!DDLIB + 'DD_idl.so','GetTime', double(TimeIntDst), /S_Value)
  20 + StepAveS = call_external(!DDLIB + 'DD_idl.so','GetTime', double(StepAve), /S_Value)
  21 +
  22 +
  23 + bm = fltarr(3);
  24 + bdd = fltarr(3,7);
  25 + UT = lonarr(7);
  26 +
  27 + p = [2., 1., 1., 1., 1., 1., 1.];
  28 + result = call_external(!PROJLIB + 'a2012fa_idl.so', 'pstatus', p);
  29 + for TimeCurr = Time[0], Time[Number-1], double(StepAve) do begin
  30 +
  31 + numOrb = where((Time - TimeCurr LT StepAve) AND (Time - TimeCurr GE 0.0), IndexOrb)
  32 + if (IndexOrb LE 0) then continue
  33 +
  34 + params = sw_monitor_a99_omni_(TimeCurr,StepAve,Orbit[*,numOrb[IndexOrb/2]])
  35 + STime = call_external(!DDLIB + 'DD_idl.so','GetTime', double(TimeCurr+StepAve/2.0), /S_Value)
  36 +
  37 + AE = ae_(STime, StepAveS, TimeDst, RetSize, Sampling, /CLOSE);
  38 + AL = RetSize GT 0 ? mean(AE[1,*]) : -100.0;
  39 +
  40 + Dst = dst_(STime, TimeIntDstS, TimeDst, RetSize, Sampling, /CLOSE);
  41 + Dst_av = RetSize GT 0 ? mean(Dst) : -10.;
  42 + ro = params[0];
  43 + v = params[1];
  44 + bimf =params[2:4];
  45 +
  46 + for i = 0, IndexOrb - 1 do begin
  47 + res = call_external(!DDLIB + 'DD_idl.so','GetGavTime', UT, double(TimeCurr+StepAve/2.0));
  48 +
  49 + x = Orbit[*,numOrb[i]];
  50 +
  51 + result = call_external(!PROJLIB + 'a2012fa_idl.so', 'model', $
  52 + UT[0], UT[1], UT[2], float(UT[3]),$
  53 + ro, v, bimf, Dst_av, AL, $
  54 + x, bm, bdd);
  55 + if bm[0] eq 0.0 then bm(*) = FillValue ;
  56 + Orbit[*,numOrb[i]] = bm;
  57 + endfor
  58 + endfor
  59 +
  60 + return
  61 +end
  62 +
  63 +
  64 +
0 65 \ No newline at end of file
... ...
amda_plus/amdalib/average.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/average.pro
... ... @@ -0,0 +1,149 @@
  1 +; $Id: average.pro,v 1.6 2012/07/06 13:24:01 budnik Exp $
  2 +;====================================================================
  3 +;--------------- Averaging for 1D & 2D arrays (second dim -> Time)
  4 +;====================================================================
  5 +
  6 +pro AVERAGE, AverStructure, T, Val
  7 +common GraphC, Graph, GraphN, Item
  8 +
  9 + FillValue = Graph[GraphN].FillValue[Item]
  10 + Yinfo = SIZE(Val)
  11 + if (Yinfo[0] GT 2) then RETURN
  12 + RetSize = Yinfo[0] eq 2 ? Yinfo[2] : Yinfo[1]
  13 +
  14 + if (Yinfo[0] eq 2) then index = Yinfo[1] eq 1 ? 0 : Yinfo[1]/2 ;
  15 +
  16 + specialCase = 0;
  17 +
  18 + if (Graph[GraphN].Step GT AverStructure.Sampling*2.0) then begin
  19 + if (finite(FillValue)) then begin
  20 +
  21 + if (Yinfo[0] eq 1) then num31 = where(Val ne FillValue, Index31) $
  22 + else begin
  23 + num31 = where(Val[index,0:RetSize-1] ne FillValue, Index31);
  24 + ; artificial truc for different spectra definitions....
  25 + if (index gt 1) then begin
  26 + num31_1 = where(Val[1,0:RetSize-1] ne FillValue, Index31_1);
  27 + if (Index31_1 ne Index31) then begin
  28 + specialCase = 1;
  29 + endif else begin
  30 + if (Index31 le 0) then begin
  31 + numTest = where(Val[*,0:RetSize-1] ne FillValue, IndexTest);
  32 + if (IndexTest gt Yinfo[1]) then specialCase = 1;
  33 + endif
  34 + endelse
  35 + endif
  36 + endelse
  37 + endif else begin
  38 + if (Yinfo[0] eq 1) then num31 = where(finite(Val), Index31) $
  39 + else begin
  40 + num31 = where(finite(Val[index,0:RetSize-1]), Index31);
  41 +; artificial truc for different spectra definitions....
  42 + if (index gt 1) then begin
  43 + num31_1 = where(finite(Val[1,0:RetSize-1]), Index31_1);
  44 + if (Index31_1 ne Index31) then begin
  45 + specialCase = 1;
  46 + endif else begin
  47 + if (Index31 le 0) then begin
  48 + numTest = where(finite(Val[*,0:RetSize-1]), IndexTest);
  49 + if (IndexTest gt Yinfo[1]) then specialCase = 1;
  50 + endif
  51 + endelse
  52 + endif
  53 + endelse
  54 + endelse
  55 +
  56 + if (specialCase) then Index31 = n_elements(T);
  57 +
  58 + if (Index31 le 0) then begin
  59 + AverStructure.Nres = -1L
  60 + return
  61 + endif
  62 +
  63 + if (specialCase) then begin
  64 + Val = REFORM(Val[*,*],Yinfo[1]*Index31)
  65 + endif else begin
  66 + T = T[num31]
  67 + Val = Yinfo[0] eq 2 ? REFORM(Val[*,num31],Yinfo[1]*Index31) : Val[num31];
  68 + endelse
  69 +
  70 + MF = AverStructure.Nres eq -1L ? Val : [*(AverStructure.LastVal),VAL]
  71 + Time = AverStructure.Nres eq -1L ? T : [*(AverStructure.LastTime),T]
  72 + N_Time = N_elements(Time)
  73 + NAve = long(((Time[N_Time-1] < Graph[GraphN].TotalTime) - Time[0]) / Graph[GraphN].Step + 1)> 1L
  74 +
  75 + if Yinfo[0] eq 2 then MF = REFORM(MF, Yinfo[1], N_Time)
  76 +
  77 + numStart = where(abs((*AverStructure.Time)-Time[0]) LE Graph[GraphN].Step/2.0, IndexStart)
  78 + if (IndexStart le 0) then begin
  79 + AverStructure.Nres = -1L
  80 + return
  81 + endif
  82 + NStart = numStart[0]
  83 +
  84 + for i = NStart, NStart+NAve-1L do begin
  85 + num = where(abs((*AverStructure.Time)[i]-Time) LE Graph[GraphN].Step/2.0, Index)
  86 + if (Index LE 0) AND (Graph[GraphN].Sampling[Item] LT Graph[GraphN].MaxSampling[Item]) then $
  87 + num = where(abs((*AverStructure.Time)[i]-Time) LE Graph[GraphN].MaxSampling[Item]/2.0, Index)
  88 + if (Index GT 0) then begin
  89 + if (Yinfo[0] eq 2) then begin
  90 + if (specialCase) then begin
  91 + for k = 0, Yinfo[1]-1 do begin
  92 + if (Index GT 1) then begin
  93 + temp = 0.0;
  94 + numK = 0;
  95 + for kk = 0, Index-1 do begin
  96 + if (finite(FillValue)) then begin
  97 + if (finite(MF[k,num[kk]])) then begin
  98 + temp += MF[k,num[kk]];
  99 + numK++;
  100 + endif
  101 + endif else begin
  102 + if (MF[k,num[kk]] ne FillValue ) then begin
  103 + temp += MF[k,num[kk]];
  104 + numK++;
  105 + endif
  106 + endelse
  107 + endfor
  108 + (*AverStructure.Val)[i*Yinfo[1]+k] = temp/ numK;
  109 + endif else (*AverStructure.Val)[i*Yinfo[1]+k] = MF[k,num[0]]
  110 + endfor
  111 + endif else (*AverStructure.Val)[i*Yinfo[1]:i*Yinfo[1]+Yinfo[1]-1] = Index GT 1 ? total(MF[*,num],2)/Index : MF[*,num[0]]
  112 + endif else (*AverStructure.Val)[i] = Index GT 1 ? total(MF[num])/Index : MF[num[0]]
  113 + endif
  114 + endfor
  115 + AverStructure.Nres = Index GT 0 ? (num[Index-1]+1) < (N_Time-1) : -1L
  116 +
  117 + if (Graph[GraphN].CurrentSec LT (Graph[GraphN].Sections-1)) AND (AverStructure.Nres ne -1) then begin
  118 + *(AverStructure.LastTime) = Time[AverStructure.NRes:*]
  119 + *(AverStructure.LastVal) = Yinfo[0] eq 2 ? REFORM(MF[*,AverStructure.NRes:N_Time-1], Yinfo[1]*(N_Time-AverStructure.Nres)) : MF[AverStructure.NRes:N_Time-1]
  120 + endif
  121 +
  122 + if (Graph[GraphN].CurrentSec eq (Graph[GraphN].Sections-1)) then begin
  123 + if ptr_valid(AverStructure.LastTime) then ptr_free, AverStructure.LastTime
  124 + if ptr_valid(AverStructure.LastVal) then ptr_free, AverStructure.LastVal
  125 + endif
  126 +
  127 + endif else begin ;if (Step GT Sampling*2.0)
  128 +
  129 + records = N_elements(*AverStructure.Time);
  130 +
  131 + if Yinfo[0] eq 2 then Val = reform(Val, Yinfo[1]*RetSize);
  132 + if (records eq 0) then begin
  133 + (*AverStructure.Time) = T; : [*AverStructure.Time,T]
  134 + (*AverStructure.Val) = Val;
  135 + endif else begin
  136 + numBefore = where((*AverStructure.Time)[records-1] GT T, IndexBefore);
  137 + if (IndexBefore eq 0) then begin
  138 + (*AverStructure.Time) = [*AverStructure.Time,T];
  139 + (*AverStructure.Val) = [*AverStructure.Val,Val];
  140 + endif else begin
  141 + (*AverStructure.Time) = [*AverStructure.Time,T[IndexBefore-1:RetSize-1]];
  142 + if (Yinfo[0] eq 1) then (*AverStructure.Val) = [*AverStructure.Val,Val[IndexBefore-1:RetSize-1]]
  143 + if (Yinfo[0] eq 2) then (*AverStructure.Val) = [*AverStructure.Val,Val[Yinfo[1]*(IndexBefore-1):Yinfo[1]*RetSize-1]]
  144 + endelse
  145 + endelse
  146 + endelse
  147 +
  148 +return
  149 +end
0 150 \ No newline at end of file
... ...
amda_plus/amdalib/averagelap.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/averagelap.pro
... ... @@ -0,0 +1,88 @@
  1 +; $Id: $
  2 +;====================================================================
  3 +;---------- Special LAP averaging 2D array
  4 +;====================================================================
  5 +
  6 +pro AVERAGELAP, AverStructure, T, Val
  7 +common GraphC, Graph, GraphN, Item
  8 +
  9 + Yinfo = SIZE(Val)
  10 + RetSize = Yinfo[2];
  11 + Val = reform(Val, Yinfo[1]*RetSize);
  12 +
  13 + if (Graph[GraphN].Step GT AverStructure.Sampling*2.0) then begin
  14 +
  15 + MF = AverStructure.Nres eq -1L ? Val : [*(AverStructure.LastVal),VAL]
  16 + Time = AverStructure.Nres eq -1L ? T : [*(AverStructure.LastTime),T]
  17 + N_Time = N_elements(Time)
  18 + NAve = long(((Time[N_Time-1] < Graph[GraphN].TotalTime) - Time[0]) / Graph[GraphN].Step + 1)> 1L
  19 +
  20 + MF = REFORM(MF, Yinfo[1], N_Time)
  21 +
  22 + numStart = where(abs((*AverStructure.Time)-Time[0]) LE Graph[GraphN].Step/2.0, IndexStart)
  23 + if (IndexStart le 0) then begin
  24 + AverStructure.Nres = -1L
  25 + return
  26 + endif
  27 +
  28 + NStart = numStart[0]
  29 +
  30 + for i = NStart, NStart+NAve-1L do begin
  31 +
  32 + num = where(abs((*AverStructure.Time)[i]-Time) LE Graph[GraphN].Step/2.0, Index)
  33 + if (Index LE 0) AND (Graph[GraphN].Sampling[Item] LT Graph[GraphN].MaxSampling[Item]) then $
  34 + num = where(abs((*AverStructure.Time)[i]-Time) LE Graph[GraphN].MaxSampling[Item]/2.0, Index)
  35 +
  36 + if (Index GT 0) then begin
  37 + for k = 0, Yinfo[1]-2 do begin
  38 + if (Index GT 1) then begin
  39 + temp = 0.0;
  40 + numK = 0;
  41 + for kk = 0, Index-1 do begin
  42 + if (finite(MF[k,num[kk]])) then begin
  43 + temp += MF[k,num[kk]];
  44 + numK++;
  45 + endif ; if (finite
  46 + endfor ; for kk
  47 + (*AverStructure.Val)[i*Yinfo[1]+k] = temp/ numK;
  48 + endif else (*AverStructure.Val)[i*Yinfo[1]+k] = MF[k,num[0]] ; if (Index GT 1)
  49 + endfor ; for k = 0,
  50 + (*AverStructure.Val)[i*Yinfo[1]+Yinfo[1]-1] = MF[Yinfo[1]-1,num[0]]
  51 + endif ; if (Index GT 0)
  52 +
  53 + endfor ; for i = NStart
  54 +
  55 + AverStructure.Nres = Index GT 0 ? (num[Index-1]+1) < (N_Time-1) : -1L
  56 +
  57 + if (Graph[GraphN].CurrentSec LT (Graph[GraphN].Sections-1)) AND (AverStructure.Nres ne -1) then begin
  58 +
  59 + *(AverStructure.LastTime) = Time[AverStructure.NRes:*]
  60 + *(AverStructure.LastVal) = REFORM(MF[*,AverStructure.NRes:N_Time-1], Yinfo[1]*(N_Time-AverStructure.Nres))
  61 + endif
  62 +
  63 + if (Graph[GraphN].CurrentSec eq (Graph[GraphN].Sections-1)) then begin
  64 + if ptr_valid(AverStructure.LastTime) then ptr_free, AverStructure.LastTime
  65 + if ptr_valid(AverStructure.LastVal) then ptr_free, AverStructure.LastVal
  66 + endif
  67 +
  68 + endif else begin ;if (Step GT Sampling*2.0)
  69 +
  70 + records = N_elements(*AverStructure.Time);
  71 +
  72 + if (records eq 0) then begin
  73 + (*AverStructure.Time) = T; : [*AverStructure.Time,T]
  74 + (*AverStructure.Val) = Val;
  75 + endif else begin
  76 + numBefore = where((*AverStructure.Time)[records-1] GT T, IndexBefore);
  77 + if (IndexBefore eq 0) then begin
  78 + (*AverStructure.Time) = [*AverStructure.Time,T];
  79 + (*AverStructure.Val) = [*AverStructure.Val,Val];
  80 + endif else begin
  81 + (*AverStructure.Time) = [*AverStructure.Time,T[IndexBefore-1:RetSize-1]];
  82 + (*AverStructure.Val) = [*AverStructure.Val,Val[Yinfo[1]*(IndexBefore-1):Yinfo[1]*RetSize-1]]
  83 + endelse
  84 + endelse
  85 + endelse
  86 +
  87 +return
  88 +end
... ...
amda_plus/amdalib/averagemip.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/averagemip.pro
... ... @@ -0,0 +1,90 @@
  1 +; $Id: $
  2 +;====================================================================
  3 +;---------- Special MIP averaging 2D array
  4 +;====================================================================
  5 +
  6 +pro AVERAGEMIP, AverStructure, T, Val
  7 +common GraphC, Graph, GraphN, Item
  8 +
  9 + Yinfo = SIZE(Val)
  10 +
  11 + if (Yinfo[0] eq 2) then begin
  12 + Val = reform(Val, Yinfo[1]*Yinfo[2]);
  13 + RetSize = Yinfo[2];
  14 +endif else RetSize = Yinfo[1];
  15 +
  16 + if (Graph[GraphN].Step GT AverStructure.Sampling*2.0) then begin
  17 + MF = AverStructure.Nres eq -1L ? Val : [*(AverStructure.LastVal),VAL]
  18 + Time = AverStructure.Nres eq -1L ? T : [*(AverStructure.LastTime),T]
  19 + N_Time = N_elements(Time)
  20 + NAve = long(((Time[N_Time-1] < Graph[GraphN].TotalTime) - Time[0]) / Graph[GraphN].Step + 1)> 1L
  21 +
  22 + MF = REFORM(MF, Yinfo[1], N_Time)
  23 +
  24 + numStart = where(abs((*AverStructure.Time)-Time[0]) LE Graph[GraphN].Step/2.0, IndexStart)
  25 + if (IndexStart le 0) then begin
  26 + AverStructure.Nres = -1L
  27 + return
  28 + endif
  29 +
  30 + NStart = numStart[0]
  31 +
  32 + for i = NStart, NStart+NAve-1L do begin
  33 +
  34 + num = where(abs((*AverStructure.Time)[i]-Time) LE Graph[GraphN].Step/2.0, Index)
  35 + if (Index LE 0) AND (Graph[GraphN].Sampling[Item] LT Graph[GraphN].MaxSampling[Item]) then $
  36 + num = where(abs((*AverStructure.Time)[i]-Time) LE Graph[GraphN].MaxSampling[Item]/2.0, Index)
  37 +
  38 + if (Index GT 0) then begin
  39 + for k = 0, Yinfo[1]-1 do begin
  40 + if (Index GT 1) then begin
  41 + temp = 0.0;
  42 + numK = 0;
  43 + for kk = 0, Index-1 do begin
  44 + ; if (finite(MF[k,num[kk]])) then begin
  45 + if (MF[k,num[kk]] GT Graph[GraphN].FillValue[Item]) then begin
  46 + temp += MF[k,num[kk]];
  47 + numK++;
  48 + endif
  49 + endfor
  50 + (*AverStructure.Val)[i*Yinfo[1]+k] = numK GT 0 ? temp/ numK : Graph[GraphN].FillValue[Item] ;
  51 + endif else begin
  52 + (*AverStructure.Val)[i*Yinfo[1]+k] = MF[k,num[0]]
  53 + endelse
  54 + endfor
  55 + endif
  56 +
  57 + endfor
  58 + AverStructure.Nres = Index GT 0 ? (num[Index-1]+1) < (N_Time-1) : -1L
  59 +
  60 + if (Graph[GraphN].CurrentSec LT (Graph[GraphN].Sections-1)) AND (AverStructure.Nres ne -1) then begin
  61 + *(AverStructure.LastTime) = Time[AverStructure.NRes:*];
  62 + *(AverStructure.LastVal) = REFORM(MF[*,AverStructure.NRes:N_Time-1], Yinfo[1]*(N_Time-AverStructure.Nres))
  63 + endif
  64 +
  65 + if (Graph[GraphN].CurrentSec eq (Graph[GraphN].Sections-1)) then begin
  66 + if ptr_valid(AverStructure.LastTime) then ptr_free, AverStructure.LastTime
  67 + if ptr_valid(AverStructure.LastVal) then ptr_free, AverStructure.LastVal
  68 + endif
  69 +
  70 + endif else begin ;if (Step GT Sampling*2.0)
  71 +
  72 + records = N_elements(*AverStructure.Time);
  73 +
  74 + if (records eq 0) then begin
  75 + (*AverStructure.Time) = T; : [*AverStructure.Time,T]
  76 + (*AverStructure.Val) = Val;
  77 + endif else begin
  78 + numBefore = where((*AverStructure.Time)[records-1] GT T, IndexBefore);
  79 + if (IndexBefore eq 0) then begin
  80 + (*AverStructure.Time) = [*AverStructure.Time,T];
  81 + (*AverStructure.Val) = [*AverStructure.Val,Val];
  82 + endif else begin
  83 + (*AverStructure.Time) = [*AverStructure.Time,T[IndexBefore-1:RetSize-1]];
  84 + (*AverStructure.Val) = [*AverStructure.Val,Val[Yinfo[1]*(IndexBefore-1):Yinfo[1]*RetSize-1]]
  85 + endelse
  86 + endelse
  87 + endelse
  88 +
  89 +return
  90 +end
0 91 \ No newline at end of file
... ...
amda_plus/amdalib/ba2000_0_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/ba2000_0_init.pro
... ... @@ -0,0 +1,41 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro ba2000_0_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  4 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  5 + THEMISD = ThemisD, THEMISE = ThemisE, $
  6 + GEOTAIL = Geotail, $
  7 + OMNI = OMNI, AMDA = AMDA, $
  8 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  9 + ; vector
  10 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  11 + DELAY = delay, $
  12 + ; all additional keywords
  13 + _EXTRA = e
  14 +
  15 + cmd = 'ba2000_init, /X'
  16 + if KEYWORD_SET(FRAME) then cmd += ',FRAME = ' + frame
  17 +
  18 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  19 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  20 +
  21 + if KEYWORD_SET(CLUSTER1) then cmd += ',/CLUSTER1'
  22 + if KEYWORD_SET(CLUSTER2) then cmd += ',/CLUSTER2'
  23 + if KEYWORD_SET(CLUSTER3) then cmd += ',/CLUSTER3'
  24 + if KEYWORD_SET(CLUSTER4) then cmd += ',/CLUSTER4'
  25 +
  26 + if KEYWORD_SET(THEMISA) then cmd += ',/THEMISA'
  27 + if KEYWORD_SET(THEMISB) then cmd += ',/THEMISB'
  28 + if KEYWORD_SET(THEMISC) then cmd += ',/THEMISC'
  29 + if KEYWORD_SET(THEMISD) then cmd += ',/THEMISD'
  30 + if KEYWORD_SET(THEMISE) then cmd += ',/THEMISE'
  31 +
  32 + if KEYWORD_SET(GEOTAIL) then cmd += ',/GEOTAIL'
  33 +
  34 + if KEYWORD_SET(OMNI) then cmd += ',/OMNI'
  35 + if KEYWORD_SET(AMDA) then cmd += ',/AMDA'
  36 +
  37 + R = execute(cmd)
  38 +
  39 +return
  40 +end
  41 +;------------------------------------------------------------
0 42 \ No newline at end of file
... ...
amda_plus/amdalib/ba2000_1_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/ba2000_1_init.pro
... ... @@ -0,0 +1,41 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro ba2000_1_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  4 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  5 + THEMISD = ThemisD, THEMISE = ThemisE, $
  6 + GEOTAIL = Geotail, $
  7 + OMNI = OMNI, AMDA = AMDA, $
  8 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  9 + ; vector
  10 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  11 + DELAY = delay, $
  12 + ; all additional keywords
  13 + _EXTRA = e
  14 +
  15 + cmd = 'ba2000_init, /Y'
  16 + if KEYWORD_SET(FRAME) then cmd += ',FRAME = ' + frame
  17 +
  18 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  19 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  20 +
  21 + if KEYWORD_SET(CLUSTER1) then cmd += ',/CLUSTER1'
  22 + if KEYWORD_SET(CLUSTER2) then cmd += ',/CLUSTER2'
  23 + if KEYWORD_SET(CLUSTER3) then cmd += ',/CLUSTER3'
  24 + if KEYWORD_SET(CLUSTER4) then cmd += ',/CLUSTER4'
  25 +
  26 + if KEYWORD_SET(THEMISA) then cmd += ',/THEMISA'
  27 + if KEYWORD_SET(THEMISB) then cmd += ',/THEMISB'
  28 + if KEYWORD_SET(THEMISC) then cmd += ',/THEMISC'
  29 + if KEYWORD_SET(THEMISD) then cmd += ',/THEMISD'
  30 + if KEYWORD_SET(THEMISE) then cmd += ',/THEMISE'
  31 +
  32 + if KEYWORD_SET(GEOTAIL) then cmd += ',/GEOTAIL'
  33 +
  34 + if KEYWORD_SET(OMNI) then cmd += ',/OMNI'
  35 + if KEYWORD_SET(AMDA) then cmd += ',/AMDA'
  36 +
  37 + R = execute(cmd)
  38 +
  39 +return
  40 +end
  41 +;------------------------------------------------------------
0 42 \ No newline at end of file
... ...
amda_plus/amdalib/ba2000_2_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/ba2000_2_init.pro
... ... @@ -0,0 +1,41 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro ba2000_2_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  4 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  5 + THEMISD = ThemisD, THEMISE = ThemisE, $
  6 + GEOTAIL = Geotail, $
  7 + OMNI = OMNI, AMDA = AMDA, $
  8 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  9 + ; vector
  10 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  11 + DELAY = delay, $
  12 + ; all additional keywords
  13 + _EXTRA = e
  14 +
  15 + cmd = 'ba2000_init, /Z'
  16 + if KEYWORD_SET(FRAME) then cmd += ',FRAME = ' + frame
  17 +
  18 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  19 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  20 +
  21 + if KEYWORD_SET(CLUSTER1) then cmd += ',/CLUSTER1'
  22 + if KEYWORD_SET(CLUSTER2) then cmd += ',/CLUSTER2'
  23 + if KEYWORD_SET(CLUSTER3) then cmd += ',/CLUSTER3'
  24 + if KEYWORD_SET(CLUSTER4) then cmd += ',/CLUSTER4'
  25 +
  26 + if KEYWORD_SET(THEMISA) then cmd += ',/THEMISA'
  27 + if KEYWORD_SET(THEMISB) then cmd += ',/THEMISB'
  28 + if KEYWORD_SET(THEMISC) then cmd += ',/THEMISC'
  29 + if KEYWORD_SET(THEMISD) then cmd += ',/THEMISD'
  30 + if KEYWORD_SET(THEMISE) then cmd += ',/THEMISE'
  31 +
  32 + if KEYWORD_SET(GEOTAIL) then cmd += ',/GEOTAIL'
  33 +
  34 + if KEYWORD_SET(OMNI) then cmd += ',/OMNI'
  35 + if KEYWORD_SET(AMDA) then cmd += ',/AMDA'
  36 +
  37 + R = execute(cmd)
  38 +
  39 +return
  40 +end
  41 +;------------------------------------------------------------
0 42 \ No newline at end of file
... ...
amda_plus/amdalib/ba2000_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/ba2000_init.pro
... ... @@ -0,0 +1,110 @@
  1 +; a2000 field along the orbit
  2 +;
  3 +
  4 +pro ba2000_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  5 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  6 + THEMISD = ThemisD, THEMISE = ThemisE, $
  7 + GEOTAIL = Geotail, $
  8 + OMNI = OMNI, AMDA = AMDA, $
  9 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  10 + ; vector
  11 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  12 + DELAY = delay, $
  13 + ; all additional keywords
  14 + _EXTRA = e
  15 +
  16 +common GraphC, graph, GraphN, Item
  17 +
  18 +
  19 + names = ['B!DX', 'B!DY', 'B!DZ', 'B']
  20 +
  21 + pen = !dnc-1 & comp = 100 & symbol = -3;
  22 +
  23 + if (KEYWORD_SET(COLOR)) then pen = color;
  24 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  25 +
  26 + title = 'CL1';
  27 + graph[GraphN].SetCommonF[0] = 'c1_xyz_com';
  28 + graph[GraphN].GetDataF[0] = 'getc1_xyz';
  29 +
  30 + if KEYWORD_SET(CLUSTER2) then begin
  31 + title = 'CL2';
  32 + graph[GraphN].SetCommonF[0] = 'c2_xyz_com';
  33 + graph[GraphN].GetDataF[0] = 'getc2_xyz';
  34 + endif
  35 + if KEYWORD_SET(CLUSTER3) then begin
  36 + title = 'CL3';
  37 + graph[GraphN].SetCommonF[0] = 'c3_xyz_com';
  38 + graph[GraphN].GetDataF[0] = 'getc3_xyz';
  39 + endif
  40 + if KEYWORD_SET(CLUSTER4) then begin
  41 + title = 'CL4'
  42 + graph[GraphN].SetCommonF[0] = 'c4_xyz_com';
  43 + graph[GraphN].GetDataF[0] = 'getc4_xyz';
  44 + endif
  45 + if KEYWORD_SET(THEMISA) then begin
  46 + title = 'THA'
  47 + graph[GraphN].SetCommonF[0] = 'tha_xyz_com';
  48 + graph[GraphN].GetDataF[0] ='gettha_xyz';
  49 + endif
  50 + if KEYWORD_SET(THEMISB) then begin
  51 + title = 'THB'
  52 + graph[GraphN].SetCommonF[0] = 'thb_xyz_com';
  53 + graph[GraphN].GetDataF[0] ='getthb_xyz';
  54 + endif
  55 + if KEYWORD_SET(THEMISC) then begin
  56 + title = 'THC'
  57 + graph[GraphN].SetCommonF[0] = 'thc_xyz_com';
  58 + graph[GraphN].GetDataF[0] ='getthc_xyz';
  59 + endif
  60 + if KEYWORD_SET(THEMISD) then begin
  61 + title = 'THD'
  62 + graph[GraphN].SetCommonF[0] = 'thd_xyz_com';
  63 + graph[GraphN].GetDataF[0] = 'getthd_xyz';
  64 + endif
  65 + if KEYWORD_SET(THEMISE) then begin
  66 + title = 'THE'
  67 + graph[GraphN].SetCommonF[0] = 'the_xyz_com';
  68 + graph[GraphN].GetDataF[0] = 'getthe_xyz';
  69 + endif
  70 + if KEYWORD_SET(GEOTAIL) then begin
  71 + title = 'GTL'
  72 + graph[GraphN].SetCommonF[0] = 'gtl_xyz_com';
  73 + graph[GraphN].GetDataF[0] = 'getgtl_xyz';
  74 + endif
  75 +
  76 +
  77 +a2000Function = KEYWORD_SET(OMNI) ? 'A2000OMNI' : 'A2000O';
  78 +
  79 +frame = "GSM";
  80 +graph[GraphN].ProcessF= 'gse2gsm;' + a2000Function;
  81 +
  82 +if (KEYWORD_SET(FRAME)) then begin
  83 + if (frame eq "GSE") then graph[GraphN].ProcessF= 'gse2gsm;' + a2000Function + ';gsm2gse';
  84 + if (frame eq "SM") then graph[GraphN].ProcessF= 'gse2gsm;' + a2000Function + ';gse2sm';
  85 +endif
  86 +
  87 +yTitle = title + ' A2000 B '+frame+', nT';
  88 +
  89 +if (KEYWORD_SET(AY1TITLE)) then graph[GraphN].Ly.title = AY1Title $
  90 +else graph[GraphN].Ly.title = yTitle
  91 +
  92 +graph[GraphN].Type = 'T96_T'
  93 +graph[GraphN].DataN = 1
  94 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 120.0D0) < 36000.0D0 ;
  95 +graph[GraphN].AxisF = 'lineaxis,' + string(Graph[GraphN].TotalTime);
  96 +
  97 +if (KEYWORD_SET(X)) then comp = 0;
  98 +if (KEYWORD_SET(Y)) then comp = 1;
  99 +if (KEYWORD_SET(Z)) then comp = 2;
  100 +if (KEYWORD_SET(TOTAL)) then comp = 3;
  101 +
  102 +graph[GraphN].PlotF = comp eq 100 ? 'PlotVec': 'PlotVec_Comp_New, ' + string(comp) +','+ string(pen ) +','+ string(symbol)
  103 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  104 +*(graph[GraphN].names) = (comp le 3) ? names : names[0:2];
  105 +
  106 +
  107 +graph[GraphN].LastPlotF = 'nodatalast'
  108 +
  109 +return
  110 +end
... ...
amda_plus/amdalib/bcain_mso_0_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bcain_mso_0_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bcain_mso_0_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bcain_mso_init, /X, SAMPLING = ' + string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bcain_mso_1_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bcain_mso_1_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bcain_mso_1_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bcain_mso_init, /Y, SAMPLING = ' + string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bcain_mso_2_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bcain_mso_2_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bcain_mso_2_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bcain_mso_init, /Z, SAMPLING = '+ string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bcain_mso_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bcain_mso_init.pro
... ... @@ -0,0 +1,73 @@
  1 +; cain field along the orbit
  2 +;
  3 +
  4 +pro bcain_mso_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  5 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  6 + ; vector
  7 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  8 + DELAY = delay, $
  9 + ; all additional keywords
  10 + _EXTRA = e
  11 +
  12 +common GraphC, graph, GraphN, Item
  13 +
  14 + names = ['B!DX', 'B!DY', 'B!DZ', 'B']
  15 +
  16 + pen = !dnc-1 & comp = 100 & symbol = -3;
  17 +
  18 + if (KEYWORD_SET(COLOR)) then pen = color;
  19 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  20 +
  21 + title = 'MEX';
  22 + graph[GraphN].SetCommonF[0] = 'mex_xyz_com';
  23 + graph[GraphN].GetDataF[0] = 'getmex_xyz';
  24 +
  25 + if KEYWORD_SET(MGS) then begin
  26 + title = 'MGS';
  27 + graph[GraphN].SetCommonF[0] = 'xyz_mgs_mso_com';
  28 + graph[GraphN].GetDataF[0] = 'getxyz_mgs_mso';
  29 + endif
  30 +
  31 + if KEYWORD_SET(MAVEN) then begin
  32 + title = 'MAVEN';
  33 + graph[GraphN].SetCommonF[0] = 'mav_xyz_mso_com';
  34 + graph[GraphN].GetDataF[0] = 'getmav_xyz_mso';
  35 + endif
  36 +
  37 +
  38 +frame = "MSO";
  39 +graph[GraphN].ProcessF = "CAIN";
  40 +;if (KEYWORD_SET(FRAME)) then begin
  41 +; if (frame eq "AC") then graph[GraphN].ProcessF= 'mso2ac';
  42 +;endif
  43 +
  44 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  45 +graph[GraphN].Type = 'T96_T'
  46 +graph[GraphN].DataN = 1
  47 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 120.0D0) < 36000.0D0 ;
  48 +
  49 +yTitle = title + ' Cain B '+frame+', nT';
  50 +
  51 +if (KEYWORD_SET(AY1TITLE)) then graph[GraphN].Ly.title = AY1Title $
  52 +else graph[GraphN].Ly.title = yTitle
  53 +
  54 +graph[GraphN].AxisF = 'lineaxis,' + string(Graph[GraphN].TotalTime)
  55 +
  56 +if (KEYWORD_SET(X)) then comp = 0;
  57 +if (KEYWORD_SET(Y)) then comp = 1;
  58 +if (KEYWORD_SET(Z)) then comp = 2;
  59 +if (KEYWORD_SET(TOTAL)) then comp = 3;
  60 +
  61 +if (KEYWORD_SET(SAMPLING)) then begin
  62 + if (Sampling eq 60) then graph[GraphN].PlotF = comp eq 100 ? 'PlotVec' : 'PlotVec_Comp_New, ' + string(comp) +','+ string(pen ) +','+ string(symbol) $
  63 + else graph[GraphN].PlotF = comp eq 100 ? 'PlotVecCain,' + string(sampling) : 'PlotVecCompCain, ' + string(sampling) +','+ string(comp) +','+ string(pen ) +','+ string(symbol)
  64 +endif else begin
  65 + graph[GraphN].PlotF = comp eq 100 ? 'PlotVec' : 'PlotVec_Comp_New, ' + string(comp) +','+ string(pen ) +','+ string(symbol)
  66 +endelse
  67 +
  68 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  69 +*(graph[GraphN].names) = (comp le 3) ? names : names[0:2];
  70 +
  71 +graph[GraphN].LastPlotF = 'nodatalast'
  72 +return
  73 +end
... ...
amda_plus/amdalib/bcain_tot_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bcain_tot_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bcain_tot_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bcain_mso_init, /TOT, SAMPLING = ' + string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bmorsch_mso_0_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bmorsch_mso_0_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bmorsch_mso_0_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bmorsch_mso_init, /X, SAMPLING = ' + string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bmorsch_mso_1_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bmorsch_mso_1_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bmorsch_mso_1_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bmorsch_mso_init, /Y, SAMPLING = ' + string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bmorsch_mso_2_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bmorsch_mso_2_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bmorsch_mso_2_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bmorsch_mso_init, /Z, SAMPLING = ' + string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bmorsch_mso_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bmorsch_mso_init.pro
... ... @@ -0,0 +1,73 @@
  1 +; morsch field along the orbit
  2 +;
  3 +
  4 +pro bmorsch_mso_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  5 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  6 + ; vector
  7 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  8 + DELAY = delay, $
  9 + ; all additional keywords
  10 + _EXTRA = e
  11 +
  12 +common GraphC, graph, GraphN, Item
  13 +
  14 + names = ['B!DX', 'B!DY', 'B!DZ', 'B']
  15 +
  16 + pen = !dnc-1 & comp = 100 & symbol = -3;
  17 +
  18 + if (KEYWORD_SET(COLOR)) then pen = color;
  19 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  20 +
  21 + title = 'MEX';
  22 + graph[GraphN].SetCommonF[0] = 'mex_xyz_com';
  23 + graph[GraphN].GetDataF[0] = 'getmex_xyz';
  24 +
  25 + if KEYWORD_SET(MGS) then begin
  26 + title = 'MGS';
  27 + graph[GraphN].SetCommonF[0] = 'xyz_mgs_mso_com';
  28 + graph[GraphN].GetDataF[0] = 'getxyz_mgs_mso';
  29 + endif
  30 +
  31 + if KEYWORD_SET(MAVEN) then begin
  32 + title = 'MAVEN';
  33 + graph[GraphN].SetCommonF[0] = 'mav_xyz_mso_com';
  34 + graph[GraphN].GetDataF[0] = 'getmav_xyz_mso';
  35 + endif
  36 +
  37 +
  38 +frame = "MSO";
  39 +graph[GraphN].ProcessF = "MORSCH";
  40 +;if (KEYWORD_SET(FRAME)) then begin
  41 +; if (frame eq "AC") then graph[GraphN].ProcessF= 'mso2ac';
  42 +;endif
  43 +
  44 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  45 +graph[GraphN].Type = 'T96_T'
  46 +graph[GraphN].DataN = 1
  47 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 120.0D0) < 36000.0D0 ;
  48 +
  49 +yTitle = title + ' Morschhauser B '+frame+', nT';
  50 +
  51 +if (KEYWORD_SET(AY1TITLE)) then graph[GraphN].Ly.title = AY1Title $
  52 +else graph[GraphN].Ly.title = yTitle
  53 +
  54 +graph[GraphN].AxisF = 'lineaxis,' + string(Graph[GraphN].TotalTime)
  55 +
  56 +if (KEYWORD_SET(X)) then comp = 0;
  57 +if (KEYWORD_SET(Y)) then comp = 1;
  58 +if (KEYWORD_SET(Z)) then comp = 2;
  59 +if (KEYWORD_SET(TOTAL)) then comp = 3;
  60 +
  61 +if (KEYWORD_SET(SAMPLING)) then begin
  62 + if (Sampling eq 60) then graph[GraphN].PlotF = comp eq 100 ? 'PlotVec' : 'PlotVec_Comp_New, ' + string(comp) +','+ string(pen ) +','+ string(symbol) $
  63 + else graph[GraphN].PlotF = comp eq 100 ? 'PlotVecCain,' + string(sampling) : 'PlotVecCompCain, ' + string(sampling) +','+ string(comp) +','+ string(pen ) +','+ string(symbol)
  64 +endif else begin
  65 + graph[GraphN].PlotF = comp eq 100 ? 'PlotVec' : 'PlotVec_Comp_New, ' + string(comp) +','+ string(pen ) +','+ string(symbol)
  66 +endelse
  67 +
  68 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  69 +*(graph[GraphN].names) = (comp le 3) ? names : names[0:2];
  70 +
  71 +graph[GraphN].LastPlotF = 'nodatalast'
  72 +return
  73 +end
... ...
amda_plus/amdalib/bmorsch_tot_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bmorsch_tot_init.pro
... ... @@ -0,0 +1,28 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bmorsch_tot_init, MEX = Mex, MGS = mgs, MAVEN = maven, SAMPLING = sampling, $
  4 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  5 + ; vector
  6 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  7 + DELAY = delay, $
  8 + ; all additional keywords
  9 + _EXTRA = e
  10 +
  11 + cmd = 'bmorsch_mso_init, /TOT, SAMPLING = ' + string(sampling)
  12 +
  13 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  14 +
  15 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  16 +
  17 + if KEYWORD_SET(MEX) then cmd += ',/MEX'
  18 +
  19 + if KEYWORD_SET(MGS) then cmd += ',/MGS'
  20 +
  21 + if KEYWORD_SET(MAVEN) then cmd += ',/MAVEN'
  22 +
  23 +
  24 + R = execute(cmd)
  25 +
  26 +return
  27 +end
  28 +;------------------------------------------------------------
0 29 \ No newline at end of file
... ...
amda_plus/amdalib/bt96_0_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bt96_0_init.pro
... ... @@ -0,0 +1,41 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bt96_0_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  4 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  5 + THEMISD = ThemisD, THEMISE = ThemisE, $
  6 + GEOTAIL = Geotail, $
  7 + OMNI = OMNI, AMDA = AMDA, $
  8 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  9 + ; vector
  10 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  11 + DELAY = delay, $
  12 + ; all additional keywords
  13 + _EXTRA = e
  14 +
  15 + cmd = 'bt96_init, /X'
  16 + if KEYWORD_SET(FRAME) then cmd += ',FRAME = ' + frame
  17 +
  18 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  19 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  20 +
  21 + if KEYWORD_SET(CLUSTER1) then cmd += ',/CLUSTER1'
  22 + if KEYWORD_SET(CLUSTER2) then cmd += ',/CLUSTER2'
  23 + if KEYWORD_SET(CLUSTER3) then cmd += ',/CLUSTER3'
  24 + if KEYWORD_SET(CLUSTER4) then cmd += ',/CLUSTER4'
  25 +
  26 + if KEYWORD_SET(THEMISA) then cmd += ',/THEMISA'
  27 + if KEYWORD_SET(THEMISB) then cmd += ',/THEMISB'
  28 + if KEYWORD_SET(THEMISC) then cmd += ',/THEMISC'
  29 + if KEYWORD_SET(THEMISD) then cmd += ',/THEMISD'
  30 + if KEYWORD_SET(THEMISE) then cmd += ',/THEMISE'
  31 +
  32 + if KEYWORD_SET(GEOTAIL) then cmd += ',/GEOTAIL'
  33 +
  34 + if KEYWORD_SET(OMNI) then cmd += ',/OMNI'
  35 + if KEYWORD_SET(AMDA) then cmd += ',/AMDA'
  36 +
  37 + R = execute(cmd)
  38 +
  39 +return
  40 +end
  41 +;------------------------------------------------------------
0 42 \ No newline at end of file
... ...
amda_plus/amdalib/bt96_1_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bt96_1_init.pro
... ... @@ -0,0 +1,41 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bt96_1_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  4 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  5 + THEMISD = ThemisD, THEMISE = ThemisE, $
  6 + GEOTAIL = Geotail, $
  7 + OMNI = OMNI, AMDA = AMDA, $
  8 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  9 + ; vector
  10 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  11 + DELAY = delay, $
  12 + ; all additional keywords
  13 + _EXTRA = e
  14 +
  15 + cmd = 'bt96_init, /Y'
  16 + if KEYWORD_SET(FRAME) then cmd += ',FRAME = ' + frame
  17 +
  18 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  19 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  20 +
  21 + if KEYWORD_SET(CLUSTER1) then cmd += ',/CLUSTER1'
  22 + if KEYWORD_SET(CLUSTER2) then cmd += ',/CLUSTER2'
  23 + if KEYWORD_SET(CLUSTER3) then cmd += ',/CLUSTER3'
  24 + if KEYWORD_SET(CLUSTER4) then cmd += ',/CLUSTER4'
  25 +
  26 + if KEYWORD_SET(THEMISA) then cmd += ',/THEMISA'
  27 + if KEYWORD_SET(THEMISB) then cmd += ',/THEMISB'
  28 + if KEYWORD_SET(THEMISC) then cmd += ',/THEMISC'
  29 + if KEYWORD_SET(THEMISD) then cmd += ',/THEMISD'
  30 + if KEYWORD_SET(THEMISE) then cmd += ',/THEMISE'
  31 +
  32 + if KEYWORD_SET(GEOTAIL) then cmd += ',/GEOTAIL'
  33 +
  34 + if KEYWORD_SET(OMNI) then cmd += ',/OMNI'
  35 + if KEYWORD_SET(AMDA) then cmd += ',/AMDA'
  36 +
  37 + R = execute(cmd)
  38 +
  39 +return
  40 +end
  41 +;------------------------------------------------------------
0 42 \ No newline at end of file
... ...
amda_plus/amdalib/bt96_2_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bt96_2_init.pro
... ... @@ -0,0 +1,41 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro bt96_2_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  4 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  5 + THEMISD = ThemisD, THEMISE = ThemisE, $
  6 + GEOTAIL = Geotail, $
  7 + OMNI = OMNI, AMDA = AMDA, $
  8 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  9 + ; vector
  10 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  11 + DELAY = delay, $
  12 + ; all additional keywords
  13 + _EXTRA = e
  14 +
  15 + cmd = 'bt96_init, /Z'
  16 + if KEYWORD_SET(FRAME) then cmd += ',FRAME = ' + frame
  17 +
  18 + if KEYWORD_SET(COLOR) then cmd += ',COLOR = ' + color;
  19 + if KEYWORD_SET(AY1TITLE) then cmd += ',AY1TITLE = ' + AY1Title;
  20 +
  21 + if KEYWORD_SET(CLUSTER1) then cmd += ',/CLUSTER1'
  22 + if KEYWORD_SET(CLUSTER2) then cmd += ',/CLUSTER2'
  23 + if KEYWORD_SET(CLUSTER3) then cmd += ',/CLUSTER3'
  24 + if KEYWORD_SET(CLUSTER4) then cmd += ',/CLUSTER4'
  25 +
  26 + if KEYWORD_SET(THEMISA) then cmd += ',/THEMISA'
  27 + if KEYWORD_SET(THEMISB) then cmd += ',/THEMISB'
  28 + if KEYWORD_SET(THEMISC) then cmd += ',/THEMISC'
  29 + if KEYWORD_SET(THEMISD) then cmd += ',/THEMISD'
  30 + if KEYWORD_SET(THEMISE) then cmd += ',/THEMISE'
  31 +
  32 + if KEYWORD_SET(GEOTAIL) then cmd += ',/GEOTAIL'
  33 +
  34 + if KEYWORD_SET(OMNI) then cmd += ',/OMNI'
  35 + if KEYWORD_SET(AMDA) then cmd += ',/AMDA'
  36 +
  37 + R = execute(cmd)
  38 +
  39 +return
  40 +end
  41 +;------------------------------------------------------------
0 42 \ No newline at end of file
... ...
amda_plus/amdalib/bt96_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/bt96_init.pro
... ... @@ -0,0 +1,108 @@
  1 +; tsyganenko 96 field along the orbit
  2 +;
  3 +
  4 +pro bt96_init, CLUSTER1 = Cluster1, CLUSTER2 = Cluster2, CLUSTER3 = Cluster3, CLUSTER4 = Cluster4, $
  5 + THEMISA = ThemisA, THEMISB = ThemisB, THEMISC = ThemisC, $
  6 + THEMISD = ThemisD, THEMISE = ThemisE, $
  7 + GEOTAIL = Geotail, $
  8 + OMNI = OMNI, AMDA = AMDA, $
  9 + PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  10 + ; vector
  11 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  12 + DELAY = delay, $
  13 + ; all additional keywords
  14 + _EXTRA = e
  15 +
  16 +common GraphC, graph, GraphN, Item
  17 +
  18 + names = ['B!DX', 'B!DY', 'B!DZ', 'B']
  19 +
  20 + pen = !dnc-1 & comp = 100 & symbol = -3;
  21 +
  22 + if (KEYWORD_SET(COLOR)) then pen = color;
  23 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  24 +
  25 + title = 'CL1';
  26 + graph[GraphN].SetCommonF[0] = 'c1_xyz_com';
  27 + graph[GraphN].GetDataF[0] = 'getc1_xyz';
  28 +
  29 + if KEYWORD_SET(CLUSTER2) then begin
  30 + title = 'CL2';
  31 + graph[GraphN].SetCommonF[0] = 'c2_xyz_com';
  32 + graph[GraphN].GetDataF[0] = 'getc2_xyz';
  33 + endif
  34 + if KEYWORD_SET(CLUSTER3) then begin
  35 + title = 'CL3';
  36 + graph[GraphN].SetCommonF[0] = 'c3_xyz_com';
  37 + graph[GraphN].GetDataF[0] = 'getc3_xyz';
  38 + endif
  39 + if KEYWORD_SET(CLUSTER4) then begin
  40 + title = 'CL4'
  41 + graph[GraphN].SetCommonF[0] = 'c4_xyz_com';
  42 + graph[GraphN].GetDataF[0] = 'getc4_xyz';
  43 + endif
  44 + if KEYWORD_SET(THEMISA) then begin
  45 + title = 'THA'
  46 + graph[GraphN].SetCommonF[0] = 'tha_xyz_com';
  47 + graph[GraphN].GetDataF[0] ='gettha_xyz';
  48 + endif
  49 + if KEYWORD_SET(THEMISB) then begin
  50 + title = 'THB'
  51 + graph[GraphN].SetCommonF[0] = 'thb_xyz_com';
  52 + graph[GraphN].GetDataF[0] ='getthb_xyz';
  53 + endif
  54 + if KEYWORD_SET(THEMISC) then begin
  55 + title = 'THC'
  56 + graph[GraphN].SetCommonF[0] = 'thc_xyz_com';
  57 + graph[GraphN].GetDataF[0] ='getthc_xyz';
  58 + endif
  59 + if KEYWORD_SET(THEMISD) then begin
  60 + title = 'THD'
  61 + graph[GraphN].SetCommonF[0] = 'thd_xyz_com';
  62 + graph[GraphN].GetDataF[0] = 'getthd_xyz';
  63 + endif
  64 + if KEYWORD_SET(THEMISE) then begin
  65 + title = 'THE'
  66 + graph[GraphN].SetCommonF[0] = 'the_xyz_com';
  67 + graph[GraphN].GetDataF[0] = 'getthe_xyz';
  68 + endif
  69 + if KEYWORD_SET(GEOTAIL) then begin
  70 + title = 'GTL'
  71 + graph[GraphN].SetCommonF[0] = 'gtl_xyz_com';
  72 + graph[GraphN].GetDataF[0] = 'getgtl_xyz';
  73 + endif
  74 +
  75 +t96Function = KEYWORD_SET(OMNI) ? 'T96OMNI' : 'T96';
  76 +
  77 +frame = "GSM";
  78 +graph[GraphN].ProcessF= t96Function;
  79 +
  80 +if (KEYWORD_SET(FRAME)) then begin
  81 + if (frame eq "GSE") then graph[GraphN].ProcessF= t96Function + ';gsm2gse';
  82 + if (frame eq "SM") then graph[GraphN].ProcessF= t96Function + ';gse2sm';
  83 +endif
  84 +
  85 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  86 +graph[GraphN].Type = 'T96_T'
  87 +graph[GraphN].DataN = 1
  88 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 120.0D0) < 36000.0D0 ;
  89 +
  90 +yTitle = title + ' T96 B '+frame+', nT';
  91 +
  92 +if (KEYWORD_SET(AY1TITLE)) then graph[GraphN].Ly.title = AY1Title $
  93 +else graph[GraphN].Ly.title = yTitle
  94 +
  95 +graph[GraphN].AxisF = 'lineaxis,' + string(Graph[GraphN].TotalTime)
  96 +
  97 +if (KEYWORD_SET(X)) then comp = 0;
  98 +if (KEYWORD_SET(Y)) then comp = 1;
  99 +if (KEYWORD_SET(Z)) then comp = 2;
  100 +if (KEYWORD_SET(TOTAL)) then comp = 3;
  101 +
  102 +graph[GraphN].PlotF = comp eq 100 ? 'PlotVec': 'PlotVec_Comp_New, ' + string(comp) +','+ string(pen ) +','+ string(symbol)
  103 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  104 +*(graph[GraphN].names) = (comp le 3) ? names : names[0:2];
  105 +
  106 +graph[GraphN].LastPlotF = 'nodatalast'
  107 +return
  108 +end
... ...
amda_plus/amdalib/c1_hia_pad_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c1_hia_pad_init.pro
... ... @@ -0,0 +1,33 @@
  1 +
  2 +pro c1_hia_pad_init, PA = PA, ENERGY = energy, LIN = lin, LOG = log
  3 +
  4 +Pitch = '0';
  5 +PitchValue = [ '0-11.25','11.25-22.5','22.5-33.75','33.75-45', $
  6 + '45-56.25','56.25-67.5','67.5-78.75', $
  7 + '78.75-90','90-101.25','101.25-112.5','112.5-123.75', $
  8 + '123.75-135','135-146.25','146.25-157.5','157.5-168.75', $
  9 + '168.75-180'];
  10 +
  11 +if (KEYWORD_SET(PA)) then Pitch = string(PA-1);
  12 +
  13 +En = 31;
  14 +if (KEYWORD_SET(ENERGY)) then En = Energy;
  15 +
  16 +
  17 + if (En LT 31) then begin
  18 + common GraphC, graph, GraphN, Item
  19 + graph[GraphN].Type = 'FGM_T'
  20 + graph[GraphN].DataN = 1
  21 + graph[GraphN].SetCommonF[0] = 'pad_hia_com, 1'
  22 + graph[GraphN].GetDataF[0] ='get_pad_hia, 1'
  23 + graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 18000.0D0
  24 + graph[GraphN].Ly.title = 'C1 hia Flux !CP_'+PitchValue[Pitch] + ' E eV ';
  25 + graph[GraphN].AxisF = KEYWORD_SET(log) ? 'logaxis' : 'lineaxis, 0';
  26 + graph[GraphN].PlotF = 'spec3D_comp_plot,' + string(Pitch) +','+string(En);
  27 + endif else begin
  28 + functionName = 'P' + strtrim(Pitch,1) + '_hia_c1_init';
  29 + call_procedure, functionName;
  30 + endelse
  31 +
  32 +return
  33 +end
0 34 \ No newline at end of file
... ...
amda_plus/amdalib/c1_whi_ne_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c1_whi_ne_.pro
... ... @@ -0,0 +1,50 @@
  1 +
  2 +; $Id: whi_ne_c1_.pro,v 1.1 2010/02/22 09:36:19 budnik Exp $
  3 +;
  4 +function c1_whi_ne_, StartTime, TimeInt, Time, RetSize, MaxSampling, close=close
  5 + common GraphC, graph, graphN
  6 + common WHINEC1_COM, ID
  7 +
  8 + FillValue = -1.0
  9 +
  10 + if n_elements(ID) EQ 0 then ID = -1L
  11 + Sampling = 1.5
  12 + MaxSampling = 104.0
  13 + Size = long(graph[graphN].DeltaT/sampling)
  14 +
  15 + VI = 'clust1:whi:whi'
  16 + Val = fltarr(Size)
  17 +
  18 + Time = dblarr(Size)
  19 +
  20 +
  21 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  22 + ID, VI, 'Density', StartTime, TimeInt, Size, Time, Val)
  23 +
  24 + if KEYWORD_SET(CLOSE) then begin
  25 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  26 + ID = -1L
  27 + endif
  28 +
  29 + if (RetSize LE 0) then begin
  30 + Time = 0.D0
  31 + return, 0.0
  32 + endif
  33 +
  34 + Time=Time[0:Retsize-1]
  35 + Val=Val[0:Retsize-1]
  36 +
  37 + num_gap = where(Val ne FillValue, Cntr)
  38 +
  39 + if Cntr le 0 then begin
  40 + Retsize = -999
  41 + Time = 0.D0
  42 + return, [0.0, 0.0, 0.0]
  43 + endif
  44 +
  45 + Time=Time[num_gap]
  46 + Val=Val[num_gap]
  47 + Retsize=Cntr
  48 +
  49 +return, Val
  50 +end
... ...
amda_plus/amdalib/c1_whi_ne_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c1_whi_ne_init.pro
... ... @@ -0,0 +1,38 @@
  1 +;-----------------WHISPER-PP_INIT--------------------------
  2 +;
  3 +pro c1_whi_ne_INIT, LIN = LIN, LOG = LOG, PSYM = psym, COLOR = color, CONTRAST = CONTRAST, UNCERTAINTY = UNCERTAINTY
  4 +
  5 +common GraphC, graph, GraphN, Item
  6 +common Request, List, StartTime, TimeInt
  7 +
  8 + names = ['Contrast', '0.7-1.0', '0.4-0.7', '0.0-0.4', 'other src']
  9 +
  10 + quality = '0';
  11 + error = '0';
  12 +
  13 + pen = !dnc-1 & symbol = -3;
  14 +
  15 + if (KEYWORD_SET(COLOR)) then pen = color;
  16 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  17 +
  18 + if KEYWORD_SET(CONTRAST) then quality = '1';
  19 + if KEYWORD_SET(UNCERTAINTY) then error = '1';
  20 +
  21 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  22 +*(graph[GraphN].names) = names;
  23 +graph[GraphN].Type = 'STAFF_T'
  24 +graph[GraphN].DataN = 3
  25 +graph[GraphN].SetCommonF[0] = 'whi_ne_com, 1'
  26 +graph[GraphN].SetCommonF[1] = 'whi_ne_qual_com, 1'
  27 +graph[GraphN].SetCommonF[2] = 'whi_ne_err_com, 1'
  28 +graph[GraphN].GetDataF[0] ='get_whi_ne, 1'
  29 +graph[GraphN].GetDataF[1] ='get_whi_ne_qual, 1'
  30 +graph[GraphN].GetDataF[2] ='get_whi_ne_err, 1'
  31 +graph[GraphN].DeltaT = (graph[GraphN].TotalTime + 10.0D0) < 18000.0D0
  32 +graph[GraphN].Ly.title = 'C1 WHI!CNe, cm!U-3 '
  33 +graph[GraphN].AxisF = KEYWORD_SET(LIN) ? 'lineaxis,0' : 'logaxis'
  34 +graph[GraphN].PlotF = 'plot_whi_ne_new,' + quality + ','+ error + ','+ string(pen) + ',' + string(symbol)
  35 +
  36 +return
  37 +end
  38 +;------------------------------------------------------------
... ...
amda_plus/amdalib/c2_whi_ne_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c2_whi_ne_.pro
... ... @@ -0,0 +1,50 @@
  1 +
  2 +; $Id: whi_ne_c2_.pro,v 1.1 2010/02/22 09:36:19 budnik Exp $
  3 +;
  4 +function c2_whi_ne_c, StartTime, TimeInt, Time, RetSize, MaxSampling, close=close
  5 + common GraphC, graph, graphN
  6 + common WHINEC2_COM, ID
  7 +
  8 + FillValue = -1.0
  9 +
  10 + if n_elements(ID) EQ 0 then ID = -1L
  11 + Sampling = 1.5
  12 + MaxSampling = 104.0
  13 + Size = long(graph[graphN].DeltaT/sampling)
  14 +
  15 + VI = 'clust2:whi:whi'
  16 + Val = fltarr(Size)
  17 +
  18 + Time = dblarr(Size)
  19 +
  20 +
  21 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  22 + ID, VI, 'Density', StartTime, TimeInt, Size, Time, Val)
  23 +
  24 + if KEYWORD_SET(CLOSE) then begin
  25 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  26 + ID = -1L
  27 + endif
  28 +
  29 + if (RetSize LE 0) then begin
  30 + Time = 0.D0
  31 + return, 0.0
  32 + endif
  33 +
  34 + Time=Time[0:Retsize-1]
  35 + Val=Val[0:Retsize-1]
  36 +
  37 + num_gap = where(Val ne FillValue, Cntr)
  38 +
  39 + if Cntr le 0 then begin
  40 + Retsize = -999
  41 + Time = 0.D0
  42 + return, [0.0, 0.0, 0.0]
  43 + endif
  44 +
  45 + Time=Time[num_gap]
  46 + Val=Val[num_gap]
  47 + Retsize=Cntr
  48 +
  49 +return, Val
  50 +end
... ...
amda_plus/amdalib/c2_whi_ne_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c2_whi_ne_init.pro
... ... @@ -0,0 +1,38 @@
  1 +;-----------------WHISPER-PP_INIT--------------------------
  2 +;
  3 +pro c2_whi_ne_INIT, LIN = LIN, LOG = LOG, PSYM = psym, COLOR = color, CONTRAST = CONTRAST, UNCERTAINTY = UNCERTAINTY
  4 +
  5 +common GraphC, graph, GraphN, Item
  6 +common Request, List, StartTime, TimeInt
  7 +
  8 + names = ['Contrast', '0.7-1.0', '0.4-0.7', '0.0-0.4', 'other src']
  9 +
  10 + quality = '0';
  11 + error = '0';
  12 +
  13 + pen = !dnc-1 & symbol = -3;
  14 +
  15 + if (KEYWORD_SET(COLOR)) then pen = color;
  16 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  17 +
  18 + if KEYWORD_SET(CONTRAST) then quality = '1';
  19 + if KEYWORD_SET(UNCERTAINTY) then error = '1';
  20 +
  21 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  22 +*(graph[GraphN].names) = names;
  23 +graph[GraphN].Type = 'STAFF_T'
  24 +graph[GraphN].DataN = 3
  25 +graph[GraphN].SetCommonF[0] = 'whi_ne_com, 2'
  26 +graph[GraphN].SetCommonF[1] = 'whi_ne_qual_com, 2'
  27 +graph[GraphN].SetCommonF[2] = 'whi_ne_err_com, 2'
  28 +graph[GraphN].GetDataF[0] ='get_whi_ne, 2'
  29 +graph[GraphN].GetDataF[1] ='get_whi_ne_qual, 2'
  30 +graph[GraphN].GetDataF[2] ='get_whi_ne_err, 2'
  31 +graph[GraphN].DeltaT = (graph[GraphN].TotalTime + 10.0D0) < 18000.0D0
  32 +graph[GraphN].Ly.title = 'C2 WHI!CNe, cm!U-3 '
  33 +graph[GraphN].AxisF = KEYWORD_SET(LIN) ? 'lineaxis,0' : 'logaxis'
  34 +graph[GraphN].PlotF = 'plot_whi_ne_new,' + quality + ','+ error + ','+ string(pen) + ',' + string(symbol)
  35 +
  36 +return
  37 +end
  38 +;------------------------------------------------------------
... ...
amda_plus/amdalib/c3_hia_pad_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c3_hia_pad_init.pro
... ... @@ -0,0 +1,33 @@
  1 +
  2 +pro c3_hia_pad_init, PA = PA, ENERGY = energy, LIN = lin, LOG = log
  3 +
  4 +Pitch = '0';
  5 +PitchValue = [ '0-11.25','11.25-22.5','22.5-33.75','33.75-45', $
  6 + '45-56.25','56.25-67.5','67.5-78.75', $
  7 + '78.75-90','90-101.25','101.25-112.5','112.5-123.75', $
  8 + '123.75-135','135-146.25','146.25-157.5','157.5-168.75', $
  9 + '168.75-180'];
  10 +
  11 +if (KEYWORD_SET(PA)) then Pitch = string(PA-1);
  12 +
  13 +En = 31;
  14 +if (KEYWORD_SET(ENERGY)) then En = Energy;
  15 +
  16 +
  17 + if (En LT 31) then begin
  18 + common GraphC, graph, GraphN, Item
  19 + graph[GraphN].Type = 'FGM_T'
  20 + graph[GraphN].DataN = 1
  21 + graph[GraphN].SetCommonF[0] = 'pad_hia_com, 3'
  22 + graph[GraphN].GetDataF[0] ='get_pad_hia, 3'
  23 + graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 18000.0D0
  24 + graph[GraphN].Ly.title = 'C3 hia Flux !CP_'+PitchValue[Pitch] + ' E eV ';
  25 + graph[GraphN].AxisF = KEYWORD_SET(log) ? 'logaxis' : 'lineaxis, 0';
  26 + graph[GraphN].PlotF = 'spec3D_comp_plot,' + string(Pitch) +','+string(En);
  27 + endif else begin
  28 + functionName = 'P' + strtrim(Pitch,1) + '_hia_c3_init';
  29 + call_procedure, functionName;
  30 + endelse
  31 +
  32 +return
  33 +end
0 34 \ No newline at end of file
... ...
amda_plus/amdalib/c3_whi_ne_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c3_whi_ne_.pro
... ... @@ -0,0 +1,50 @@
  1 +
  2 +; $Id: whi_ne_c3_.pro,v 1.1 2010/02/22 09:36:19 budnik Exp $
  3 +;
  4 +function c3_whi_ne_, StartTime, TimeInt, Time, RetSize, MaxSampling, close=close
  5 + common GraphC, graph, graphN
  6 + common WHINEC3_COM, ID
  7 +
  8 + FillValue = -1.0
  9 +
  10 + if n_elements(ID) EQ 0 then ID = -1L
  11 + Sampling = 1.5
  12 + MaxSampling = 104.0
  13 + Size = long(graph[graphN].DeltaT/sampling)
  14 +
  15 + VI = 'clust3:whi:whi'
  16 + Val = fltarr(Size)
  17 +
  18 + Time = dblarr(Size)
  19 +
  20 +
  21 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  22 + ID, VI, 'Density', StartTime, TimeInt, Size, Time, Val)
  23 +
  24 + if KEYWORD_SET(CLOSE) then begin
  25 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  26 + ID = -1L
  27 + endif
  28 +
  29 + if (RetSize LE 0) then begin
  30 + Time = 0.D0
  31 + return, 0.0
  32 + endif
  33 +
  34 + Time=Time[0:Retsize-1]
  35 + Val=Val[0:Retsize-1]
  36 +
  37 + num_gap = where(Val ne FillValue, Cntr)
  38 +
  39 + if Cntr le 0 then begin
  40 + Retsize = -999
  41 + Time = 0.D0
  42 + return, [0.0, 0.0, 0.0]
  43 + endif
  44 +
  45 + Time=Time[num_gap]
  46 + Val=Val[num_gap]
  47 + Retsize=Cntr
  48 +
  49 +return, Val
  50 +end
... ...
amda_plus/amdalib/c3_whi_ne_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c3_whi_ne_init.pro
... ... @@ -0,0 +1,38 @@
  1 +;-----------------WHISPER-PP_INIT--------------------------
  2 +;
  3 +pro c3_whi_ne_INIT, LIN = LIN, LOG = LOG, PSYM = psym, COLOR = color, CONTRAST = CONTRAST, UNCERTAINTY = UNCERTAINTY
  4 +
  5 +common GraphC, graph, GraphN, Item
  6 +common Request, List, StartTime, TimeInt
  7 +
  8 + names = ['Contrast', '0.7-1.0', '0.4-0.7', '0.0-0.4', 'other src']
  9 +
  10 + quality = '0';
  11 + error = '0';
  12 +
  13 + pen = !dnc-1 & symbol = -3;
  14 +
  15 + if (KEYWORD_SET(COLOR)) then pen = color;
  16 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  17 +
  18 + if KEYWORD_SET(CONTRAST) then quality = '1';
  19 + if KEYWORD_SET(UNCERTAINTY) then error = '1';
  20 +
  21 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  22 +*(graph[GraphN].names) = names;
  23 +graph[GraphN].Type = 'STAFF_T'
  24 +graph[GraphN].DataN = 3
  25 +graph[GraphN].SetCommonF[0] = 'whi_ne_com, 3'
  26 +graph[GraphN].SetCommonF[1] = 'whi_ne_qual_com, 3'
  27 +graph[GraphN].SetCommonF[2] = 'whi_ne_err_com, 3'
  28 +graph[GraphN].GetDataF[0] ='get_whi_ne, 3'
  29 +graph[GraphN].GetDataF[1] ='get_whi_ne_qual, 3'
  30 +graph[GraphN].GetDataF[2] ='get_whi_ne_err, 3'
  31 +graph[GraphN].DeltaT = (graph[GraphN].TotalTime + 10.0D0) < 18000.0D0
  32 +graph[GraphN].Ly.title = 'C3 WHI!CNe, cm!U-3 '
  33 +graph[GraphN].AxisF = KEYWORD_SET(LIN) ? 'lineaxis,0' : 'logaxis'
  34 +graph[GraphN].PlotF = 'plot_whi_ne_new,' + quality + ','+ error + ','+ string(pen) + ',' + string(symbol)
  35 +
  36 +return
  37 +end
  38 +;------------------------------------------------------------
... ...
amda_plus/amdalib/c4_whi_ne_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c4_whi_ne_.pro
... ... @@ -0,0 +1,50 @@
  1 +
  2 +; $Id: whi_ne_c4_.pro,v 1.1 2010/02/22 09:36:19 budnik Exp $
  3 +;
  4 +function c4_whi_ne_, StartTime, TimeInt, Time, RetSize, MaxSampling, close=close
  5 + common GraphC, graph, graphN
  6 + common WHINEC4_COM, ID
  7 +
  8 + FillValue = -1.0
  9 +
  10 + if n_elements(ID) EQ 0 then ID = -1L
  11 + Sampling = 1.5
  12 + MaxSampling = 104.0
  13 + Size = long(graph[graphN].DeltaT/sampling)
  14 +
  15 + VI = 'clust4:whi:whi'
  16 + Val = fltarr(Size)
  17 +
  18 + Time = dblarr(Size)
  19 +
  20 +
  21 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  22 + ID, VI, 'Density', StartTime, TimeInt, Size, Time, Val)
  23 +
  24 + if KEYWORD_SET(CLOSE) then begin
  25 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  26 + ID = -1L
  27 + endif
  28 +
  29 + if (RetSize LE 0) then begin
  30 + Time = 0.D0
  31 + return, 0.0
  32 + endif
  33 +
  34 + Time=Time[0:Retsize-1]
  35 + Val=Val[0:Retsize-1]
  36 +
  37 + num_gap = where(Val ne FillValue, Cntr)
  38 +
  39 + if Cntr le 0 then begin
  40 + Retsize = -999
  41 + Time = 0.D0
  42 + return, [0.0, 0.0, 0.0]
  43 + endif
  44 +
  45 + Time=Time[num_gap]
  46 + Val=Val[num_gap]
  47 + Retsize=Cntr
  48 +
  49 +return, Val
  50 +end
... ...
amda_plus/amdalib/c4_whi_ne_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/c4_whi_ne_init.pro
... ... @@ -0,0 +1,38 @@
  1 +;-----------------WHISPER-PP_INIT--------------------------
  2 +;
  3 +pro c4_whi_ne_INIT, LIN = LIN, LOG = LOG, PSYM = psym, COLOR = color, CONTRAST = CONTRAST, UNCERTAINTY = UNCERTAINTY
  4 +
  5 +common GraphC, graph, GraphN, Item
  6 +common Request, List, StartTime, TimeInt
  7 +
  8 + names = ['Contrast', '0.7-1.0', '0.4-0.7', '0.0-0.4', 'other src']
  9 +
  10 + quality = '0';
  11 + error = '0';
  12 +
  13 + pen = !dnc-1 & symbol = -3;
  14 +
  15 + if (KEYWORD_SET(COLOR)) then pen = color;
  16 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  17 +
  18 + if KEYWORD_SET(CONTRAST) then quality = '1';
  19 + if KEYWORD_SET(UNCERTAINTY) then error = '1';
  20 +
  21 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  22 +*(graph[GraphN].names) = names;
  23 +graph[GraphN].Type = 'STAFF_T'
  24 +graph[GraphN].DataN = 3
  25 +graph[GraphN].SetCommonF[0] = 'whi_ne_com, 4'
  26 +graph[GraphN].SetCommonF[1] = 'whi_ne_qual_com, 4'
  27 +graph[GraphN].SetCommonF[2] = 'whi_ne_err_com, 4'
  28 +graph[GraphN].GetDataF[0] ='get_whi_ne, 4'
  29 +graph[GraphN].GetDataF[1] ='get_whi_ne_qual, 4'
  30 +graph[GraphN].GetDataF[2] ='get_whi_ne_err, 4'
  31 +graph[GraphN].DeltaT = (graph[GraphN].TotalTime + 10.0D0) < 18000.0D0
  32 +graph[GraphN].Ly.title = 'C4 WHI!CNe, cm!U-3 '
  33 +graph[GraphN].AxisF = KEYWORD_SET(LIN) ? 'lineaxis,0' : 'logaxis'
  34 +graph[GraphN].PlotF = 'plot_whi_ne_new,' + quality + ','+ error + ','+ string(pen) + ',' + string(symbol)
  35 +
  36 +return
  37 +end
  38 +;------------------------------------------------------------
... ...
amda_plus/amdalib/cain.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/cain.pro
... ... @@ -0,0 +1,26 @@
  1 +pro cain, Time, Orbit
  2 +
  3 + FillValue = -1.e31
  4 + Number = N_elements(Time)
  5 + Bmso = fltarr(3)
  6 + Rm = 3393.0;
  7 +
  8 + num31 = where(Orbit[0,*] ne FillValue, Index31)
  9 + if (Index31 le 0) then return
  10 +
  11 + Time = Time[num31];
  12 + Orbit = Orbit[*,num31]*Rm;
  13 + err = call_external(!PROJLIB + '/idl_cain.so', 'CainSetUp');
  14 +
  15 + for i = 0L, Index31-1L do begin
  16 + julday = doubl2jd(Time[i]);
  17 + err = call_external(!PROJLIB + '/idl_cain.so', 'CainField', julday, Orbit[*,i], Bmso);
  18 + if (Bmso[0] eq 0.0) then Bmso(*) = FillValue;
  19 + Orbit[*,i] = Bmso;
  20 + endfor
  21 +
  22 + return
  23 +end
  24 +
  25 +
  26 +
0 27 \ No newline at end of file
... ...
amda_plus/amdalib/doubl2jd.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/doubl2jd.pro
... ... @@ -0,0 +1,22 @@
  1 +;----------------------------------------------------------
  2 +; IMA COMMON LIB (IDL)
  3 +; doubl2jd.pro
  4 +; V.1.0
  5 +;
  6 +; Function which Julian Day time from DD double time
  7 +;
  8 +; Versions:
  9 +; Jan 25 2005, V.1.0
  10 +;===========================================================
  11 +
  12 +function Doubl2JD, Time
  13 + CTimeS = call_external(!DDLIB + 'DD_idl.so','GetTime', Time, /S_VALUE)
  14 + Year = fix(STRMID(CTimeS, 0, 4) )
  15 + Day = double(STRMID(CTimeS, 4, 3))
  16 + Hour = fix(STRMID(CTimeS, 7, 2))
  17 + Minute = fix(STRMID(CTimeS, 9, 2))
  18 + Second = fix(STRMID(CTimeS, 11, 2))
  19 + JDReal = JULDAY(01, 01, Year, Hour, Minute, Second) + Day
  20 + return,JDReal
  21 +end
  22 +
... ...
amda_plus/amdalib/dst_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/dst_init.pro
... ... @@ -0,0 +1,23 @@
  1 +;----------------DST_INIT--------------------------
  2 +;
  3 +pro DST_INIT, LOG=LOG, LIN=LIN, RED=RED, BLUE=BLUE, GREEN=GREEN
  4 +
  5 +common GraphC, graph, GraphN, Item
  6 +pen = 0
  7 +
  8 + if KEYWORD_SET(RED) then pen = 3
  9 + if KEYWORD_SET(BLUE) then pen = 1
  10 + if KEYWORD_SET(GREEN) then pen = 2
  11 +
  12 +graph[GraphN].Type = 'DST_T'
  13 +graph[GraphN].DataN = 1
  14 +graph[GraphN].SetCommonF[0] = 'dstcom'
  15 +graph[GraphN].GetDataF[0] ='getdst'
  16 +graph[GraphN].DeltaT = (graph[graphN].TotalTime+120.0D0) < 86400.0D0
  17 +graph[GraphN].Ly.title = 'DST, nT'
  18 +graph[GraphN].AxisF = 'lineaxis,' + string(graph[graphN].TotalTime)
  19 +graph[GraphN].PlotF = 'dstplot,' + string(pen);
  20 +
  21 +return
  22 +end
  23 +;------------------------------------------------------------
... ...
amda_plus/amdalib/dstplot.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/dstplot.pro
... ... @@ -0,0 +1,33 @@
  1 +;============================================================
  2 +;
  3 +; DST Time Profile PLOT
  4 +;
  5 +;
  6 +;=============================================================
  7 +
  8 + pro dstplot, pen
  9 +; procedure to plot prepared data on prepared graph
  10 +
  11 + common GraphC, Graph, GraphN
  12 + colour = [!dnc - 1, !dnc*20/256, !dnc*90/256, !dnc - 2]
  13 +
  14 + Time = Graph[GraphN].Time[0]
  15 + if (N_elements(*Time) eq 0) then return
  16 + Val = (*Graph[GraphN].Val[0])
  17 + numMinMax = where(Val gt -10000.0, IndexMinMax)
  18 + if IndexMinMax LE 0 then return
  19 + MinVal = min(Val[numMinMax])
  20 + MaxVal = max(Val[numMinMax])
  21 + if Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] then begin
  22 + Graph[GraphN].Ly.range = [MinVal, MaxVal]
  23 + Graph[GraphN].Ly.style = 0
  24 + endif else Graph[GraphN].Ly.style = 1
  25 +
  26 + !y = Graph[GraphN].Ly
  27 +
  28 + if (execute(Graph[GraphN].AxisF) NE 1) then plot, *Time, Val, PSYM = 10, color = !DNC-1 else $
  29 + oplot, *Time, Val, PSYM = 10, color=colour[pen];
  30 +
  31 +return
  32 +end
  33 +;--------------------------------------------------------------------
... ...
amda_plus/amdalib/e_mgs_omni_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/e_mgs_omni_init.pro
... ... @@ -0,0 +1,64 @@
  1 +;---------------------------------------------------
  2 +; $Id: e_mgs_omni_init.pro,v 1.3 2013/03/28 08:40:06 budnik Exp $
  3 +; MGS ER SPECTRA OMNI init
  4 +;
  5 +;----------------------------------------------------
  6 +
  7 +pro e_mgs_omni_init, LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  8 + ; spectra
  9 + MINCOUNT = minCount, MAXCOUNT = maxCount, BACKGRDCHAN = backgrdChan, BACKGRDVAL = backgrdVal, $
  10 + CHANNEL = channel, Energy = energy, ENERGYMIN = energymin, ENERGYMAX = energymax, $
  11 +
  12 + ; vector
  13 + DELAY = delay, $
  14 + ; all additional keywords
  15 + _EXTRA = e
  16 +
  17 + common Request, List, StartTime, TimeInt
  18 + common GraphC, graph, GraphN, Item
  19 +
  20 + pen = !dnc-1 & comp = 100 & symbol = -3;
  21 +
  22 + if (KEYWORD_SET(COLOR)) then pen = color;
  23 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  24 +
  25 + graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  26 + *(graph[GraphN].names) = 'log Flux 1/(cm!U2!N*s*ster*eV)'
  27 +
  28 + graph[GraphN].Type = 'ER_T'
  29 + graph[GraphN].DataN = 1
  30 + graph[GraphN].SetCommonF[0] = 'e_mgs_omni_com'
  31 + graph[GraphN].GetDataF[0] = 'get_e_mgs_omni'
  32 +
  33 + graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 36100.0D0
  34 +
  35 +EnMin = 11;
  36 +EnMax = 16217;
  37 +
  38 +energyTitle = '';
  39 +
  40 + if (KEYWORD_SET(energymin)) then begin
  41 + EnMin = energymin;
  42 + if (KEYWORD_SET(energymax)) then EnMax = energymax else EnMax = energymin;
  43 + energyTitle = energymin eq energymax ? '!CE ' + strtrim(string(energymin),1) + 'eV' : '!CE ' + strtrim(string(energymin),1) + '-'+ strtrim(string(energymax),1) + ' eV';
  44 + endif else energyTitle = '!Call energies';
  45 +
  46 + options = string(EnMin) +','+string(EnMax);
  47 +
  48 +
  49 + if (KEYWORD_SET(ENERGYMIN)) then begin
  50 + graph[GraphN].AxisF = KEYWORD_SET(log) ? 'logaxis' : 'lineaxis, 0';
  51 + ytitle = 'MGS e-Flux (cm!U2!N*s*st*eV)!U-1' + energyTitle;
  52 + PlotF = 'spec_comp_plot, '+ options;
  53 + endif else begin
  54 + ytitle = 'MGS e-Flux!C Energy, eV'
  55 + PlotF = 'e_mgs_omni_plot'
  56 + endelse
  57 +
  58 + graph[GraphN].PlotF = PlotF;
  59 + if (KEYWORD_SET(AY1TITLE)) then graph[GraphN].Ly.title = AY1Title $
  60 + else graph[GraphN].Ly.title = yTitle
  61 +
  62 +return
  63 +end
  64 +;------------------------------------------------------------
... ...
amda_plus/amdalib/earthorbaxis.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/earthorbaxis.pro
... ... @@ -0,0 +1,121 @@
  1 +;==================================================
  2 +; DD
  3 +; ORBITAL OBJECTS
  4 +; mexorbaxis.pro
  5 +; V.2.0
  6 +; Modifications:
  7 +; 19 May 2006: V.1.0, Fedorov
  8 +; 09 Dec 2006: V.2.0, Fedorov, New approach for graphical environment
  9 +;---------------------------------------------------
  10 +; Implementation of all types of axis for orbital plot
  11 +; Options:
  12 +; Key ToPlot
  13 +; /CYL - cylindrical XR 0
  14 +; /XY 1
  15 +; /XZ 2
  16 +; /YZ 3
  17 +;====================================================
  18 +
  19 +pro earthorbaxis, ToPlot
  20 +common GraphC, graph, GraphN
  21 +
  22 +;------------ Set graphics Colors ------------------------
  23 + if (Graph[GraphN].Lx.range[0] eq Graph[GraphN].Lx.range[1]) then begin
  24 + Graph[GraphN].Lx.range[0] = -20;
  25 + Graph[GraphN].Lx.range[1] = 10;
  26 + endif
  27 + if (Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1]) then begin
  28 + Graph[GraphN].Ly.range[0] = ToPlot eq 0 ? 0: -20;
  29 + Graph[GraphN].Ly.range[1] = 10;
  30 + endif
  31 +
  32 + !x = Graph[GraphN].Lx
  33 + !y = Graph[GraphN].Ly
  34 +
  35 + x = !x.range
  36 + y = !y.range
  37 + black = !DNC- 1
  38 + zero = fix(!DNC * 20.0/ 256.0 )
  39 + planet = fix(!DNC * 10.0/ 256.0)
  40 + bound = fix(!DNC * 1.0/ 256.0)
  41 +;------------------------------------------------------------
  42 +
  43 + ThickPlanet = 2
  44 + ThickBound = 2
  45 +
  46 +;------- main axis -----------------
  47 + case ToPlot of
  48 + 0: begin
  49 + !x.title = 'X, R!DE'
  50 + !y.title = 'R, R!DE'
  51 + end
  52 + 1: begin
  53 + !x.title = 'X, R!DE'
  54 + !y.title = 'Y, R!DE'
  55 + end
  56 + 2: begin
  57 + !x.title = 'X, R!DE'
  58 + !y.title = 'Z, R!DE'
  59 + end
  60 + 3: begin
  61 + !x.title = 'Y, R!DE'
  62 + !y.title = 'Z, R!DE'
  63 + end
  64 + endcase
  65 +
  66 + ;------ Plot main axis. Use common Graph system variables
  67 + plot,x,y,/nodata,/noerase,xstyle=1,ystyle=1,color=black,xminor=1, yminor=1, charsize=graph[GraphN].Lp.charsize
  68 +
  69 + ;------- plot Zero lines ---------------------
  70 + oplot,x,[0,0],color=zero, thick = 1
  71 + oplot,[0,0],y,color=zero, thick = 1
  72 +
  73 + ;------- plot Earth ---------------------
  74 + dal = 2.0 * !PI / 60.
  75 + if ToPlot EQ 0 then $
  76 + al = dal * findgen(31) $
  77 + else al = dal * findgen(61)
  78 +
  79 + xx = cos(al)
  80 + yy = sin(al)
  81 + oplot,xx,yy,color=black, thick = ThickPlanet
  82 +
  83 + if ToPlot EQ 0 then begin
  84 + ;---- Plot boundaries for cylindrical plot
  85 + ;----------------------- Bow Shock -----------------------------
  86 + RamPress = 1.5
  87 + theta = (135.*!pi/180.)*findgen(100)/100.
  88 +
  89 +
  90 + ; rr = 2.04/(1.0+1.02*cos(theta))
  91 + xx = fltarr(100)
  92 + yy = fltarr(100)
  93 +
  94 + epsilon = 0.81
  95 + L0 = 24.8
  96 + ramP = 1.8
  97 + L_BS = L0*(RamPress/ramP)^(-1./6.)
  98 +
  99 + rr=L_BS/(1.+epsilon*COS(theta))
  100 + xx = rr *cos(theta)
  101 + yy = rr*sin(theta)
  102 +
  103 + oplot,xx,yy,color=bound, thick = ThickBound
  104 + oplot,xx,-yy,color=bound, thick = ThickBound
  105 +
  106 + ;----------------------- MP Shue-----------------------------
  107 + Bz = -1.0
  108 +
  109 + alpha=(.58-.007*Bz)*(1.+0.024*alog(RamPress))
  110 + r0=(10.22+1.29*tanh(0.184*(Bz+8.14)))*RamPress^(-1./6.6)
  111 + rr=r0*(2./(1.+COS(theta)))^alpha
  112 +
  113 + xx = rr*cos(theta)
  114 + yy = rr*sin(theta)
  115 +
  116 + oplot,xx,yy,color=bound, thick = ThickBound
  117 + oplot,xx,-yy,color=bound, thick = ThickBound
  118 +
  119 + endif
  120 +return
  121 +end
... ...
amda_plus/amdalib/elscntplot.pro 0 → 100755
  1 +++ a/amda_plus/amdalib/elscntplot.pro
... ... @@ -0,0 +1,133 @@
  1 +;==========================================================
  2 +; DD DDMARS/DDVEX
  3 +; elscntplot.pro
  4 +;
  5 +;-----------------------------------------------------------
  6 +
  7 +pro elscntplot, Mission, anodStart, anodStop, enMin, enMax
  8 +
  9 +common VexELS, VexELS, VexElsPlus
  10 +common MexELS, MexELS, MexElsPlus
  11 +common GraphC, Graph,GraphN, Item
  12 +common request, List, StartTime, TimeInt
  13 +
  14 + cmd = 'ElsPlus = ' + Mission + 'ElsPlus'
  15 + R = execute(cmd);
  16 +
  17 + ; Expand DeltaT a little : Get Energy Calibration
  18 +
  19 + StD = call_external(!DDLIB+'DD_idl.so','GetDTime', StartTime, /D_VALUE)
  20 + DtD = call_external(!DDLIB+'DD_idl.so','GetDTime', TimeInt, /D_VALUE)
  21 + StD = StD - 100.0D0
  22 + DtD = DtD + 200.0D0
  23 + stloc = call_external(!DDLIB+'DD_idl.so','GetTime',StD, /S_VALUE)
  24 + dtloc = call_external(!DDLIB+'DD_idl.so','GetTime',DtD, /S_VALUE)
  25 + Size = Long(DtD/4. + 2)
  26 + Nen = 128;
  27 + Energy = fltarr(Nen, Size)
  28 + Tm = dblarr(Size)
  29 + ID = -1L;
  30 +
  31 + err = call_external(!PROJLIB + 'libplanetcom.so','SetMission_idl', Mission);
  32 + RetSize = call_external(!PROJLIB + 'els_idl.so','GetRef', $
  33 + ID, $
  34 + stloc, $
  35 + dtloc, $
  36 + Size, $
  37 + Tm, $
  38 + Energy)
  39 + if (err GE 0) then Tm -= Graph[GraphN].TimeBase
  40 + err = call_external(!DDLIB +'DD_idl.so','CloseID',ID)
  41 +
  42 +; data
  43 +
  44 + Time = (*Graph[GraphN].Time[0]);
  45 + N_Time = N_elements(Time);
  46 +
  47 + Val = (*Graph[GraphN].Val[0]);
  48 + Val = temporary(reform(Val, 16, Nen, N_Time));
  49 +
  50 + num = where(abs(Tm - Time[N_Time/2]) EQ min(abs(Tm - Time[N_Time/2])));
  51 +
  52 + E = Energy[*,num[0]]*ElsPlus.Sens[7];
  53 +
  54 + if ((enmin eq enmax) and (enmin eq 0)) then begin
  55 + enmax = E[0];
  56 + enmin = E[126];
  57 + endif
  58 +
  59 + Data = anodStop GT anodStart ? total(Val[anodStart:anodStop,*,*],1) : reform(Val[anodStart,*,*], 128, N_Time);
  60 +
  61 +; if reduced Energy Table
  62 +
  63 + reducedEnergy = E[0] LT 1000.0 ? 1 : 0;
  64 + ; if reduced Energy Table expand time
  65 + if (reducedEnergy) then begin
  66 + Nen = 32;
  67 + enMax = enMax < 158.0;
  68 + newTime = dblarr(N_Time*4);
  69 + for i = 0, N_Time-1 do for j = 0, 3 do newTime[i*4+j] = Time[i] + double(j);
  70 + Time = newTime;
  71 + Data = reform(Data, Nen, N_Time*4);
  72 + N_Time *= 4;
  73 + E = E(0:Nen-1);
  74 + endif
  75 +
  76 + E[Nen-1] = E[Nen-2];
  77 + EBounds = fltarr(Nen+1);
  78 + EBounds[0] = E[0];
  79 + EBounds[Nen] = E[Nen-1];
  80 + for ie = 1, Nen-1 do EBounds(ie) = sqrt(E(ie-1)*E(ie));
  81 +
  82 + num0 = where(EBounds ge enMin, Index0);
  83 + num1 = where(EBounds ge enMax, Index1);
  84 +
  85 + if (Index1 eq Nen+1) then begin
  86 + nodatafortimeinterval
  87 + return
  88 + endif
  89 +
  90 + if (Index1 eq 0) then numStop = 0 else numStop = num1[Index1-1];
  91 +
  92 + if (Index0 eq Nen+1) then numStart = 31 else numStart = num0[Index0-1];
  93 +
  94 + Data = numStart ne numStop ? total(Data[numStop:numStart,*],1) : reform(Data[numStart,*], N_Time);
  95 + ; Data = IndexE gt 1 ? total(Data[numE,*],1) : reform(Data[numE[0],*], N_Time);
  96 +
  97 + ; if (avEnergy) then Data /= IndexE;
  98 + ; if (avAngle) then Data /= (anodStop-anodStart+1);
  99 +
  100 + numMinMax = where(finite(Data), IndexMinMax)
  101 +
  102 + ;--------------------- No DATA - just axes -----------------------
  103 +
  104 + if (IndexMinMax LE 0) then begin
  105 + nodatafortimeinterval
  106 + return
  107 + endif
  108 +
  109 + if (Time[0] GT Graph[GraphN].TotalTime) then begin
  110 + nodatafortimeinterval
  111 + return
  112 + endif
  113 + ;-------------------------------------------------------------------
  114 +
  115 + ;TODO test mode if E(1) EQ E(126) then begin ; The test mode, just plot everything???
  116 + MinVal = min(Data[numMinMax]);
  117 + MaxVal = max(Data[numMinMax]);
  118 +
  119 + if Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] then begin
  120 + Graph[GraphN].Ly.range = Graph[GraphN].AxisF eq 'logaxis' ? [MinVal, MaxVal] : [0.0, MaxVal]
  121 + Graph[GraphN].Ly.style = 0
  122 + endif else Graph[GraphN].Ly.style = 1
  123 +
  124 + !y = Graph[GraphN].Ly;
  125 +
  126 +
  127 + if (execute(Graph[GraphN].AxisF) NE 1) then plot, Time, Data, MAX_VALUE=MaxValue, color = !dnc-1, /NODATA, /NOERASE
  128 + oplot, Time, Data, MAX_VALUE=MaxValue, color = !dnc-1
  129 +
  130 +
  131 +return
  132 +end
  133 +;--------------------------------------------------------------------
... ...
amda_plus/amdalib/elsspecplot.pro 0 → 100755
  1 +++ a/amda_plus/amdalib/elsspecplot.pro
... ... @@ -0,0 +1,160 @@
  1 +;==========================================================
  2 +; DD DDMARS/DDVEX
  3 +; elsetplot.pro
  4 +; V.3.2
  5 +; Constructor of ELSET object
  6 +; Plot of the ET spectrogram of ELS count.
  7 +; Mandatory arguments: FirstAnode, LastAnode
  8 +; Keywords: no keywords
  9 +; Resource control the color scale
  10 +;
  11 +; Versions:
  12 +; 28 Jan 2004: V.1.0
  13 +; 18 han 2005: V.2.0 Fedorov, variable energy range
  14 +; 30 May 2007: V.3.2, Fedorov. Anodes interval. Blue background
  15 +;-----------------------------------------------------------
  16 +
  17 +pro elsspecplot, Mission, anodStart, anodStop
  18 +
  19 +common VexELS, VexELS, VexElsPlus
  20 +common MexELS, MexELS, MexElsPlus
  21 +common GraphC, Graph,GraphN, Item
  22 +common request, List, StartTime, TimeInt
  23 +
  24 + cmd = 'ElsPlus = ' + Mission + 'ElsPlus'
  25 + R = execute(cmd);
  26 +
  27 + ; Expand DeltaT a little : Get Energy Calibration
  28 +
  29 + StD = call_external(!DDLIB+'DD_idl.so','GetDTime', StartTime, /D_VALUE)
  30 + DtD = call_external(!DDLIB+'DD_idl.so','GetDTime', TimeInt, /D_VALUE)
  31 + StD = StD - 100.0D0
  32 + DtD = DtD + 200.0D0
  33 + stloc = call_external(!DDLIB+'DD_idl.so','GetTime',StD, /S_VALUE)
  34 + dtloc = call_external(!DDLIB+'DD_idl.so','GetTime',DtD, /S_VALUE)
  35 + Size = Long(DtD/4. + 2)
  36 + Energy = fltarr(128, Size)
  37 + Tm = dblarr(Size)
  38 + ID = -1L;
  39 +
  40 + err = call_external(!PROJLIB + 'libplanetcom.so','SetMission_idl', Mission);
  41 + RetSize = call_external(!PROJLIB + 'els_idl.so','GetRef', $
  42 + ID, $
  43 + stloc, $
  44 + dtloc, $
  45 + Size, $
  46 + Tm, $
  47 + Energy)
  48 +
  49 +
  50 + if (err GE 0) then Tm -= Graph[GraphN].TimeBase
  51 + err = call_external(!DDLIB +'DD_idl.so','CloseID',ID)
  52 +
  53 + Time = (*Graph[GraphN].Time[0])
  54 + N_Time = N_elements(Time);
  55 +
  56 + EnumbFull = 128
  57 + EnumbReduced = 31
  58 +
  59 + E = fltarr(EnumbFull)
  60 +
  61 + ;-------- Cat in the Energy range ------------
  62 + E0 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? 0.610171 : Graph[GraphN].Ly.range[0]
  63 + E1 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? 20832.0: Graph[GraphN].Ly.range[1]
  64 +
  65 + Val = (*Graph[GraphN].Val[0])
  66 + Val = temporary(reform(Val, 16, 128, N_Time))
  67 + LocVal = anodStop GT anodStart ? total(Val[anodStart:anodStop,*,*],1) : reform(Val[anodStart,*,*], 128, N_Time);
  68 +
  69 + numMinMax = where(finite(LocVal), IndexMinMax)
  70 +
  71 + if (Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1]) then $
  72 + Graph[GraphN].Ly.range = [E0, E1]
  73 +
  74 + Graph[GraphN].Ly.style = 1
  75 +
  76 + !y = Graph[GraphN].Ly
  77 +
  78 + plot_io, graph[GraphN].Lx.range, graph[GraphN].Ly.range, /nodata, /noerase, ystyle = 1, $
  79 + ytickformat='yticks', charsize=graph[GraphN].Lp.charsize*0.8, color = !dnc-1
  80 +
  81 + ;--------------------- No DATA - just axes -----------------------
  82 +
  83 + if (IndexMinMax LE 0) then begin
  84 + nodatafortimeinterval
  85 + return
  86 + endif
  87 + if (Time[0] GT Graph[GraphN].TotalTime) then begin
  88 + nodatafortimeinterval
  89 + return
  90 + endif
  91 + MinVal = min(LocVal[numMinMax]) > 1.0
  92 + MaxVal = max(LocVal[numMinMax])
  93 +
  94 + Step = Graph[GraphN].Sampling[0] > Graph[GraphN].Step;
  95 + StepMax = Graph[GraphN].MaxSampling[0] > Step
  96 + ;----------- NOW PLOT SPECTRA
  97 + alogMin = alog(MinVal)
  98 + KF = float(!DNC - 2) /(alog(MaxVal) - alogMin)
  99 + xx = fltarr(4) & yy = fltarr(4)
  100 +
  101 + for i = 0, N_Time - 2 do begin
  102 +
  103 + num = where(abs(Tm - Time[i]) EQ min(abs(Tm - Time[i])));
  104 + E = anodStop GT anodStart ? Energy[*,num[0]]*ElsPlus.Sens[4] : Energy[*,num[0]]*ElsPlus.Sens[anodStart];
  105 + FullEnergy = 1;
  106 + if (mission eq "VEX") then FullEnergy = E[0] GT 1000.0 ? 1 : 0;
  107 +
  108 + Enumb = FullEnergy ? EnumbFull :EnumbReduced
  109 +
  110 + eindex = where((E[0:Enumb-1] GE E0) AND $
  111 + (E[0:Enumb-1] LE E1) AND $
  112 + (E[0:Enumb-1] GT 0.0),counte)
  113 +
  114 + if (FullEnergy) then E[127] = E[126]
  115 + if (counte GT 0) AND (E[1] NE E[126]) then begin
  116 + EBounds = fltarr(ENumb+1)
  117 + EBounds(min(eindex)) = E(min(eindex))
  118 + EBounds(max(eindex+1)) = E(max(eindex))
  119 + for ie = min(eindex+1), max(eindex) do EBounds(ie) = sqrt(E(ie-1)*E(ie))
  120 + endif else begin
  121 + if E(1) EQ E(126) then begin ; The test mode, just plot everything
  122 + eindex = indgen(128)
  123 + step = exp(alog(E1/E0)/127.0)
  124 + E = E0 * step^findgen(128)
  125 + EBounds = fltarr(ENumb+1)
  126 + EBounds(min(eindex)) = E(min(eindex))
  127 + EBounds(max(eindex+1)) = E(max(eindex))
  128 + for ie = min(eindex+1), max(eindex) do EBounds(ie) = sqrt(E(ie-1)*E(ie))
  129 + endif else ERRFLAG = 1
  130 + endelse
  131 + if (not FullEnergy) then for kk = 0, 30 do for kkk = 1, 3 do LocVal[kk,i] += LocVal[kk+kkk*32,i]/4.0
  132 +
  133 + xx[0] = Time[i] > 0.0
  134 + xx[1] = xx[0]
  135 + xx[2] = Time[i+1] < Time[i] + StepMax
  136 + if (xx[2] GT graph[GraphN].TotalTime) then xx[2] = graph[GraphN].TotalTime
  137 + xx[3]= xx[2]
  138 +
  139 + if (xx[0] LT graph[GraphN].TotalTime AND xx[2] LE graph[GraphN].TotalTime) then begin
  140 + for k = min(eindex), max(eindex) do begin
  141 + yy[0] = EBounds[k]
  142 + yy[1] = EBounds[k+1]
  143 + yy[2]=yy[1]
  144 + yy[3]=yy[0]
  145 + lcount = LocVal[k,i]
  146 + cl = finite(lcount) ? fix(KF*(alog(lcount) - alogMin)) > 1 : 0;
  147 + if (cl GT !DNC - 2) then cl = !DNC - 2
  148 + PolyFill, xx ,yy, color = cl, /data
  149 + endfor
  150 + endif
  151 + endfor
  152 +
  153 +;-------------------- Legend ----------------------------------------
  154 + spec_legend, MinVal, MaxVal
  155 +;------------------ MIN-MAX------------------------------------------------
  156 + Graph[GraphN].Min = MinVal
  157 +
  158 +return
  159 +end
  160 +;--------------------------------------------------------------------
... ...
amda_plus/amdalib/get_ica_spec.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_ica_spec.pro
... ... @@ -0,0 +1,46 @@
  1 +;===========================================================
  2 +;=============================================================
  3 +
  4 +pro Get_Ica_Spec, StartTime, TimeInt
  5 +
  6 +common IcaSpecCom, Spec
  7 +common GraphC, Graph, GraphN, Item
  8 +common Etab, Flag, Tab
  9 +
  10 +;------------Get data-----------------------------
  11 +
  12 + ID = Long(graph[GraphN].DataID[Item])
  13 +
  14 + Size = Spec.DefSize
  15 + TimeArr = dblarr(Size);
  16 + Spectra = fltarr(96, 16, 16, Size)
  17 +; PaccArr = lonarr(Size);
  18 + EnergyTab = intarr(Size);
  19 + VI = "ros:ica:all";
  20 + paramName = "no_counts_summed";
  21 +
  22 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  23 + ID, VI, paramName, $
  24 + StartTime, TimeInt, Size, $
  25 + TimeArr, Spectra)
  26 +
  27 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  28 + ID, VI, "energyTab", $
  29 + StartTime, TimeInt, Size, $
  30 + TimeArr, EnergyTab)
  31 +
  32 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  33 + if (RetSize GT 0) then begin
  34 + Spectra = temporary(reform(Spectra[*,*,*,0:RetSize-1], 96L*16L*16L, RetSize));
  35 + TimeArr -= graph[GraphN].TimeBase
  36 + graph[GraphN].DataFlags[Item] = 1
  37 + graph[GraphN].dataTime[Item] = TimeArr[0]
  38 + average, Spec, TimeArr[0:RetSize-1], Spectra
  39 + if (Flag eq GraphN) then immediate, Tab, TimeArr[0:RetSize-1], float(EnergyTab[0:RetSize-1]);
  40 + endif; else Graph[GraphN].ErrorFlag = 1
  41 +
  42 +
  43 +
  44 +return
  45 +end
  46 +;------------------------------------------------------------
... ...
amda_plus/amdalib/get_ima_o_spec.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_ima_o_spec.pro
... ... @@ -0,0 +1,56 @@
  1 +;===========================================================
  2 +; Get_Vex_H_Spec
  3 +;
  4 +; 18 Mars 2009
  5 +;=============================================================
  6 +
  7 +pro Get_Ima_O_Spec, Mission, StartTime, TimeInt, RESTRICTED = restricted
  8 +
  9 +common VexOSpecCom, VexOSpec
  10 +common MexOSpecCom, MexOSpec
  11 +common GraphC, Graph, GraphN, Item
  12 +common Etab, FlagVex, EtabVex, FlagMex, EtabMex
  13 +
  14 +
  15 + cmd = 'Spec = ' + Mission + 'OSpec & Tab = Etab' + Mission;
  16 + R = execute(cmd);
  17 +
  18 + Flag = Mission eq 'vex' ? FlagVex : FlagMex;
  19 +
  20 +;------------Get data-----------------------------
  21 +
  22 + ID = Long(graph[GraphN].DataID[Item])
  23 +
  24 + Size = Spec.DefSize
  25 + TimeArr = dblarr(Size);
  26 + Spectra = fltarr(16, 96, 16, Size)
  27 + Product = 'HEAVYSPEC';
  28 + PaccArr = intarr(Size);
  29 + EnergyTab = intarr(Size);
  30 +
  31 + if (ID eq -1L) then begin
  32 + err = call_external(!PROJLIB + 'libplanetcom.so','SetMission_idl', Mission);
  33 + if (KEYWORD_SET(RESTRICTED)) then err = call_external(!PROJLIB + 'libplanetcom.so','SetRestriction');
  34 + endif
  35 + RetSize = call_external(!PROJLIB + 'libImaExtra.so','GetImaExtra_idl',$
  36 + ID, StartTime, TimeInt,$
  37 + Product, Size, $
  38 + TimeArr, PaccArr, EnergyTab, Spectra)
  39 +
  40 +
  41 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  42 + if (RetSize GT 1) then begin
  43 + Spectra = temporary(reform(Spectra[*,*,*,0:RetSize-1], 16L*96L*16L,RetSize));
  44 + TimeArr -= graph[GraphN].TimeBase
  45 + graph[GraphN].DataFlags[Item] = 1
  46 + graph[GraphN].dataTime[Item] = TimeArr[0]
  47 + average, Spec, TimeArr[0:RetSize-1], Spectra
  48 + if (Flag eq GraphN) then immediate, Tab, TimeArr[0:RetSize-1], float(EnergyTab[0:RetSize-1]);
  49 + endif; else Graph[GraphN].ErrorFlag = 1
  50 +
  51 + cmd = Mission + 'OSpec = Spec & Etab' + Mission +'= Tab'
  52 + R = execute(cmd);
  53 +
  54 +return
  55 +end
  56 +;------------------------------------------------------------
... ...
amda_plus/amdalib/get_imam_h_spec.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_imam_h_spec.pro
... ... @@ -0,0 +1,78 @@
  1 +;===========================================================
  2 +; Get_Vex_H_Spec
  3 +;
  4 +; 18 Mars 2009
  5 +;=============================================================
  6 +
  7 +pro Get_ImaM_H_Spec, StartTime, TimeInt, RESTRICTED = restricted
  8 +
  9 +common MexHSpecCom, Spec
  10 +common InternalImaMex, Energy
  11 +common GraphC, Graph, GraphN, Item
  12 +common Etab, FlagVex, EtabVex, FlagMex, EtabMex
  13 +
  14 +FORWARD_FUNCTION gfl
  15 +;------------Get data-----------------------------
  16 +
  17 + ID = Long(graph[GraphN].DataID[Item])
  18 +
  19 + Size = Spec.DefSize
  20 + TimeArr = dblarr(Size);
  21 + SpectraTot = fltarr(16, 96, 16, 2, Size)
  22 + Product = 'HPSPEC';
  23 + PaccArr = intarr(Size);
  24 + EnergyTab = intarr(Size);
  25 +
  26 + Mission = "mex";
  27 +
  28 + if (ID eq -1L) then begin
  29 + err = call_external(!PROJLIB + 'libplanetcom.so','SetMission_idl', Mission);
  30 + if (KEYWORD_SET(RESTRICTED)) then err = call_external(!PROJLIB + 'libplanetcom.so','SetRestriction');
  31 + endif
  32 +
  33 + EnNum = 96
  34 + Energy = fltarr(EnNum)
  35 +
  36 + RetSize = call_external(!PROJLIB + 'libImaExtra.so','GetImaExtra_idl',$
  37 + ID, StartTime, TimeInt,$
  38 + Product, Size, $
  39 + TimeArr, PaccArr, EnergyTab, SpectraTot)
  40 +
  41 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  42 +
  43 + err = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy, EnergyTab[0])
  44 + Energy = temporary(Energy(where(Energy GT 0)));
  45 +
  46 + if (RetSize GT 1) then begin
  47 +
  48 + Spectra = fltarr(16, 96, 16, RetSize);
  49 +
  50 + for i = 0, RetSize - 1 do begin
  51 +
  52 + if (i ne RetSize - 1) then $
  53 + if (EnergyTab[i] ne EnergyTab[i+1]) then begin
  54 + err = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy, EnergyTab[i+1])
  55 + Energy = temporary(Energy(where(Energy GT 0)));
  56 + endif
  57 +
  58 + for j = 0, N_elements(Energy) - 1 do begin
  59 + GFeff = gfl(Energy[j], PaccArr[i], 1.0);
  60 + GFeffG = gfl(Energy[j], PaccArr[i], 0.0); Ghost
  61 +
  62 + coeffH = GFeff GT 0 ? 1.e-5/GFeff : 0.0;
  63 + coeffG = GFeffG GT 0 ? 1.e-5/GFeffG : 0.0;
  64 +
  65 + Spectra[*,j,*,i] = SpectraTot[*,j,*,0,i]*coeffH + SpectraTot[*,j,*,1,i] * coeffG;
  66 + endfor
  67 + endfor
  68 +
  69 + TimeArr -= graph[GraphN].TimeBase
  70 + graph[GraphN].DataFlags[Item] = 1
  71 + graph[GraphN].dataTime[Item] = TimeArr[0]
  72 + average, Spec, TimeArr[0:RetSize-1], reform(Spectra,16L*96L*16L,RetSize)
  73 + if (FlagMex eq GraphN) then immediate, EtabMex, TimeArr[0:RetSize-1], float(EnergyTab[0:RetSize-1]);
  74 + endif else Graph[GraphN].ErrorFlag = 1
  75 +
  76 +return
  77 +end
  78 +;------------------------------------------------------------
... ...
amda_plus/amdalib/get_mode_peir.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_mode_peir.pro
... ... @@ -0,0 +1,48 @@
  1 +;-------------------- Get THEMIS Modeity ION -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro Get_Mode_Peir, THEMIS, st, dt
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common ThaModePeirCom, ThaMode
  8 +common ThbModePeirCom, ThbMode
  9 +common ThcModePeirCom, ThcMode
  10 +common ThdModePeirCom, ThdMode
  11 +common TheModePeirCom, TheMode
  12 +
  13 + cmd = 'ThMode = Th'+THEMIS+'Mode'
  14 + R = execute(cmd)
  15 +
  16 + sz = ThMode.DefSize
  17 + T=dblarr(sz)
  18 + mode = fltarr(3,sz);
  19 +
  20 + ID = Long(graph[GraphN].DataID[Item])
  21 +
  22 + VI = 'th'+THEMIS+':peir:mom'
  23 +CONT:
  24 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  25 + ID, VI, 'Mode', st, dt, sz, T, mode)
  26 +
  27 + if (Retsize eq -34) OR (Retsize eq -35) OR (Retsize eq -0) then begin
  28 + wait, 3
  29 + goto, CONT
  30 + endif
  31 +
  32 +
  33 + if (RetSize GT 1) then begin
  34 +
  35 + Val = mode[2, 0:Retsize-1]
  36 + T -= graph[GraphN].TimeBase
  37 + graph[GraphN].DataID[Item] = ID
  38 + graph[GraphN].DataFlags[Item] = 1
  39 + graph[GraphN].dataTime[Item] = T[0]
  40 + immediate, ThMode, T[0:RetSize-1], Val
  41 + endif
  42 +
  43 + cmd = 'Th'+THEMIS+'Mode = ThMode'
  44 + R = execute(cmd)
  45 +
  46 +return
  47 +end
  48 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/get_multi.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_multi.pro
... ... @@ -0,0 +1,86 @@
  1 +;;
  2 +;---------------------------------------
  3 +
  4 +pro GET_MULTI, st, dt
  5 +
  6 +common Multi_Commom, getStart, N_VIs, DataCommon
  7 +common GraphC, graph, GraphN, Item
  8 +
  9 + FillValue = !Values.F_NAN
  10 +
  11 + StartTime = call_external(!DDLIB +'DD_idl.so','GetDTime', st, /D_VALUE)
  12 + TimeCalc = dindgen(Graph[GraphN].ppp)*Graph[GraphN].Step + StartTime + Graph[GraphN].Step/2.0;
  13 + k = 0;
  14 +
  15 + for i = 0, N_VIs[graphN] - 1 do begin
  16 +
  17 + if(Graph[GraphN].CurrentSec EQ Graph[GraphN].Sections-1) then $
  18 + *(DataCommon[i, GraphN].data) = Call_Function(DataCommon[i, GraphN].name, st, dt, Time, RetSize, Sampling, /close) $
  19 + else *(DataCommon[i, GraphN].data) = Call_Function(DataCommon[i, GraphN].name, st, dt, Time, RetSize, Sampling)
  20 +
  21 + if (RetSize GT 0) then begin
  22 + ;
  23 + ; Different processing if 1D array and RetSize = 1
  24 + ;
  25 + Yinfo = size(*DataCommon[i, GraphN].data);
  26 + if (Yinfo[0] eq 1) then begin
  27 + if (RetSize gt 1) then begin
  28 + (*DataCommon[i, GraphN].data) = reform((*DataCommon[i, GraphN].data),1, RetSize);
  29 + DataCommon[i, GraphN].size[1] = 1;
  30 + endif else (*DataCommon[i, GraphN].data) = reform((*DataCommon[i, GraphN].data), Yinfo[1], RetSize);
  31 + endif else DataCommon[i, GraphN].size[1] = Yinfo[1]
  32 +
  33 + *(DataCommon[i, GraphN].Time) = Time;
  34 +
  35 +; Several data sections
  36 + if (Graph[GraphN].Sections gt 1) then begin
  37 + if (N_elements(*(DataCommon[i, GraphN].LastTime)) GT 0) then $
  38 + if (*(DataCommon[i, GraphN].LastTime) LT Time[0]) then begin
  39 + *(DataCommon[i, GraphN].Time) = [*(DataCommon[i, GraphN].LastTime),Time]
  40 + TempArr = fltarr(DataCommon[i, GraphN].size[1],Retsize+1)
  41 + TempArr[*,0] = *(DataCommon[i, GraphN].LastData)
  42 + TempArr[*,1:*] = *(DataCommon[i, GraphN].data)
  43 + *(DataCommon[i, GraphN].data) = TempArr
  44 + *(DataCommon[i, GraphN].LastTime) = Time[RetSize-1];
  45 + *(DataCommon[i, GraphN].LastData) = (*DataCommon[i, GraphN].data)[*,RetSize-1];
  46 + RetSize += 1;
  47 + endif else begin
  48 + *(DataCommon[i, GraphN].LastTime) = Time[RetSize-1];
  49 + *(DataCommon[i, GraphN].LastData) = (*DataCommon[i, GraphN].data)[*,RetSize-1];
  50 + endelse
  51 + endif ; if (Graph[GraphN].Sections gt 1)
  52 + TempArr = 0.0
  53 + endif ; if (RetSize GT 0)
  54 +
  55 + DataCommon[i, GraphN].size[0] = RetSize;
  56 + DataCommon[i, GraphN].Sampling = Sampling;
  57 +
  58 + if (DataCommon[i, GraphN].Sampling LT Graph[GraphN].Step/2.0) then begin
  59 + Y = reform(replicate(FillValue, DataCommon[i, GraphN].size[1]*Graph[GraphN].ppp), DataCommon[i, GraphN].size[1], Graph[GraphN].ppp);
  60 + Flag = intarr(N_elements(TimeCalc));
  61 + averaging_, *(DataCommon[i, GraphN].time), *(DataCommon[i, GraphN].data), TimeCalc, Y, Flag;
  62 + *DataCommon[i, GraphN].data = Y;
  63 + *(DataCommon[i, GraphN].Time) = TimeCalc;
  64 + endif
  65 +
  66 + indices = *(DataCommon[i, GraphN].indices);
  67 +
  68 + if (N_Elements(indices) gt 0) then begin
  69 + for j = 0, N_Elements(indices) - 1 do begin
  70 + *(Graph[GraphN].Val)[k] = getStart[GraphN] ? [*(Graph[GraphN].Val)[k],reform((*DataCommon[i, GraphN].data)[indices[j],*])] : reform((*DataCommon[i, GraphN].data)[indices[j],*]);
  71 + *(Graph[GraphN].Time)[k] = getStart[GraphN] ? [*(Graph[GraphN].Time)[k], *(DataCommon[i, GraphN].Time)-Graph[GraphN].TimeBase] : *(DataCommon[i, GraphN].Time)-Graph[GraphN].TimeBase;
  72 + k += 1;
  73 + endfor
  74 + endif else begin
  75 + *(Graph[GraphN].Val)[k] = getStart[GraphN] ? [*(Graph[GraphN].Val)[k],*(DataCommon[i, GraphN].data)] : *(DataCommon[i, GraphN].data);
  76 + *(Graph[GraphN].Time)[k] = getStart[GraphN] ? [*(Graph[GraphN].Time)[k], *(DataCommon[i, GraphN].Time)-Graph[GraphN].TimeBase] : *(DataCommon[i, GraphN].Time)-Graph[GraphN].TimeBase;
  77 + k += 1;
  78 + endelse
  79 +
  80 + endfor
  81 +
  82 + Graph[GraphN].DataFlags = 1
  83 + Graph[GraphN].ErrorFlag = 0
  84 + getStart[GraphN] = 1;
  85 +return
  86 +end
... ...
amda_plus/amdalib/get_scatter.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_scatter.pro
... ... @@ -0,0 +1,108 @@
  1 +;;
  2 +;---------------------------------------
  3 +
  4 +pro GET_SCATTER, st, dt
  5 +
  6 +common Scatter_Commom, getStart, N_param, indices, DataCommon
  7 +common GraphC, graph, GraphN, Item
  8 +
  9 + FillValue = !Values.F_NAN
  10 +
  11 + for i = 0, N_param[graphN] - 1 do begin
  12 + if(Graph[GraphN].CurrentSec EQ Graph[GraphN].Sections-1) then $
  13 + *(DataCommon[i, GraphN].data) = Call_Function(DataCommon[i, GraphN].name, st, dt, Time, RetSize, Sampling, /close) $
  14 + else *(DataCommon[i, GraphN].data) = Call_Function(DataCommon[i, GraphN].name, st, dt, Time, RetSize, Sampling)
  15 +
  16 + if (RetSize GT 0) then begin
  17 + ;
  18 + ; Different processing if 1D array and RetSize = 1
  19 + ;
  20 +
  21 + Yinfo = size(*DataCommon[i, GraphN].data);
  22 + if (Yinfo[0] eq 1) then begin
  23 + if (RetSize gt 1) then begin
  24 + (*DataCommon[i, GraphN].data) = reform((*DataCommon[i, GraphN].data), 1, RetSize);
  25 + DataCommon[i, GraphN].size[1] = 1;
  26 + endif else (*DataCommon[i, GraphN].data) = reform((*DataCommon[i, GraphN].data), Yinfo[1], RetSize);
  27 + endif else DataCommon[i, GraphN].size[1] = Yinfo[1]
  28 +
  29 + *(DataCommon[i, GraphN].Time) = Time;
  30 +
  31 +; Several data sections
  32 + if (Graph[GraphN].Sections gt 1) then begin
  33 + if (N_elements(*(DataCommon[i, GraphN].LastTime)) GT 0) then $
  34 + if (*(DataCommon[i, GraphN].LastTime) LT Time[0]) then begin
  35 + *(DataCommon[i, GraphN].Time) = [*(DataCommon[i, GraphN].LastTime),Time]
  36 + TempArr = fltarr(DataCommon[i, GraphN].size[1],Retsize+1)
  37 + TempArr[*,0] = *(DataCommon[i, GraphN].LastData)
  38 + TempArr[*,1:*] = *(DataCommon[i, GraphN].data)
  39 + *(DataCommon[i, GraphN].data) = TempArr
  40 + *(DataCommon[i, GraphN].LastTime) = Time[RetSize-1];
  41 + *(DataCommon[i, GraphN].LastData) = (*DataCommon[i, GraphN].data)[*,RetSize-1];
  42 + RetSize += 1;
  43 + endif else begin
  44 + *(DataCommon[i, GraphN].LastTime) = Time[RetSize-1];
  45 + *(DataCommon[i, GraphN].LastData) = (*DataCommon[i, GraphN].data)[*,RetSize-1];
  46 + endelse
  47 + endif else if (Yinfo[0] gt 1) then DataCommon[i, GraphN].size[1] = Yinfo[1]
  48 + TempArr = 0.0
  49 + endif
  50 + DataCommon[i, GraphN].size[0] = RetSize;
  51 + DataCommon[i, GraphN].Sampling = Sampling;
  52 + endfor
  53 +
  54 +; Processing Y
  55 + if (DataCommon[0, GraphN].Sampling LT Graph[GraphN].Step/2.0) then begin
  56 + StartTime = call_external(!DDLIB+'DD_idl.so','GetDTime',st, /D_VALUE)
  57 + TimeInterval = call_external(!DDLIB+'DD_idl.so','GetDTime',dt, /D_VALUE)
  58 + numberPoints = long(TimeInterval/Graph[GraphN].Step + 0.5);
  59 + toAverageY = 1;
  60 + Time = dindgen(numberPoints)*Graph[GraphN].Step + StartTime+ Graph[GraphN].Step/2.0;
  61 + Y = reform(replicate(FillValue, DataCommon[0, GraphN].size[1]*numberPoints), DataCommon[0, GraphN].size[1],numberPoints);
  62 + Flag = intarr(N_elements(Time));
  63 + averaging_, *(DataCommon[0, GraphN].time), *(DataCommon[0, GraphN].data), Time, Y, Flag;
  64 + if (getStart[graphN]) then begin
  65 + *Graph[GraphN].Val[1] = [*Graph[GraphN].Val[1], reform(Y[indices[0,graphN],*],numberPoints)]
  66 + endif else begin
  67 + *Graph[GraphN].Val[1] = reform(Y[indices[0,graphN],*],numberPoints);
  68 + endelse
  69 + endif else begin
  70 + toAverageY = 0;
  71 + Time = *DataCommon[0, GraphN].time;
  72 + if (getStart[graphN]) then *Graph[GraphN].Val[1] = [*Graph[GraphN].Val[1], reform((*DataCommon[0, GraphN].data)[indices[0],*],DataCommon[0, GraphN].size[0])] $
  73 + else *Graph[GraphN].Val[1] = reform((*DataCommon[0, GraphN].data)[indices[0,graphN],*], DataCommon[0, GraphN].size[0]);
  74 + endelse
  75 +
  76 +; Processing X
  77 +; the same parameter - different component
  78 + if (N_param[graphN] eq 1) then begin
  79 + if (toAverageY) then X = reform(Y[indices[1,graphN],*],numberPoints) $
  80 + else X = reform((*DataCommon[0, GraphN].data)[indices[1,graphN],*],DataCommon[0, GraphN].size[0]);
  81 + if (getStart[graphN]) then *Graph[GraphN].Val[0] = [*Graph[GraphN].Val[0], X] $
  82 + else *Graph[GraphN].Val[0] = X;
  83 + endif else begin
  84 + if (toAverageY) then step = Graph[GraphN].Step $
  85 + else step = DataCommon[0, GraphN].Sampling;
  86 +
  87 + X = reform(replicate(FillValue, DataCommon[1, GraphN].size[1]*N_Elements(Time)), DataCommon[1, GraphN].size[1], N_Elements(Time));
  88 + Flag = intarr(N_elements(Time));
  89 + if (DataCommon[1, GraphN].Sampling LT step/2.0) then $
  90 + averaging_, *(DataCommon[1, GraphN].time), (*DataCommon[1, GraphN].data)[indices[1,graphN],*], Time, X, Flag $
  91 + else $
  92 + interpolation_, *(DataCommon[1, GraphN].time), (*DataCommon[1, GraphN].data)[indices[1,graphN],*], DataCommon[1, GraphN].Sampling*3, Time, X, Flag;
  93 + if (getStart[graphN]) then *Graph[GraphN].Val[0] = [*Graph[GraphN].Val[0], reform(X)] $
  94 + else *Graph[GraphN].Val[0] = reform(X);
  95 + endelse
  96 +
  97 + if (toAverageY) then begin
  98 + if (Graph[GraphN].CurrentSec EQ 0) then *Graph[GraphN].Time[0] = dindgen(Graph[GraphN].ppp)*Graph[GraphN].Step + StartTime + Graph[GraphN].Step/2.0;
  99 + endif else begin
  100 + if (getStart[graphN]) then *Graph[GraphN].Time[0] = [*Graph[GraphN].Time[0], Time] $
  101 + else *Graph[GraphN].Time[0] = Time
  102 + endelse
  103 +
  104 + Graph[GraphN].DataFlags = 1
  105 + Graph[GraphN].ErrorFlag = 0
  106 + getStart[GraphN] = 1;
  107 +return
  108 +end
... ...
amda_plus/amdalib/get_th_e_sp.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_th_e_sp.pro
... ... @@ -0,0 +1,42 @@
  1 +;-------------------- Get THEMIS SPECTRA ION -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro Get_Th_E_Sp, THEMIS, st, dt
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common ThaeSpecCom, ThaeSpec
  8 +common ThbeSpecCom, ThbeSpec
  9 +common ThceSpecCom, ThceSpec
  10 +common ThdeSpecCom, ThdeSpec
  11 +common TheeSpecCom, TheeSpec
  12 +
  13 + cmd = 'TheSpec = Th'+THEMIS+'eSpec'
  14 + R = execute(cmd)
  15 +
  16 + sz = TheSpec.DefSize
  17 + V=dblarr(32,sz)
  18 + T=dblarr(sz)
  19 +
  20 + ID = Long(graph[GraphN].DataID[Item])
  21 +
  22 + VI = 'th'+THEMIS+':esa:l2e'
  23 +
  24 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  25 + ID, VI, 'Flux', st, dt, sz, T, V);
  26 +
  27 +
  28 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  29 + if (RetSize GT 1) then begin
  30 + Val = float(V[*,0:RetSize-1])
  31 + T -= graph[GraphN].TimeBase
  32 + graph[GraphN].DataFlags[Item] = 1
  33 + graph[GraphN].dataTime[Item] = T[0]
  34 + average, TheSpec, T[0:RetSize-1], Val
  35 + endif else Graph[GraphN].ErrorFlag = 1
  36 +
  37 + cmd = 'Th'+THEMIS+'eSpec = TheSpec'
  38 + R = execute(cmd)
  39 +
  40 +return
  41 +end
  42 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/get_vexmex_dens.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_vexmex_dens.pro
... ... @@ -0,0 +1,58 @@
  1 +;-------------------- Get THEMIS ION Velocity -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro Get_VexMex_Dens, Mission, Product, st, dt, RESTRICTED = restricted
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common VexHDensCom, VexH
  8 +common VexODensCom, VexO
  9 +common MexHDensCom, MexH
  10 +common MexODensCom, MexO
  11 +
  12 + cmd = 'VEX = ' + Mission + Product;
  13 + R = execute(cmd)
  14 +
  15 + sz = Vex.DefSize
  16 +
  17 + Quality = fltarr(sz)
  18 + Val = fltarr(sz)
  19 + Time = dblarr(sz)
  20 +
  21 + ID = Long(graph[GraphN].DataID[Item])
  22 +
  23 + VI = Mission + ':ima:param'
  24 +
  25 + if (KEYWORD_SET(RESTRICTED)) then VI = Mission + ':imaparam:restricted'
  26 +
  27 + ParamNameQ = Product eq "h" ? "Quality_P" : "Quality_O";
  28 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  29 + ID, VI, ParamNameQ, st, dt, sz, Time, Quality)
  30 +
  31 + ParamName = Product eq "h" ? "Density_P" : "Density_O";
  32 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  33 + ID, VI, ParamName, st, dt, sz, Time, Val)
  34 +
  35 +
  36 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  37 + if (RetSize GT 1) then begin
  38 + stD = call_external(!DDLIB + 'DD_idl.so','GetDTime', st, /D_VALUE)
  39 + numTime = where(Time GE stD AND Time LE (stD+graph[graphN].DeltaT), IndexTime)
  40 + if IndexTime EQ 0 then return
  41 + Time = temporary(Time[numTime])
  42 + Val = temporary(Val[numTime])
  43 + Quality = temporary(Quality[numTime])
  44 + Density = fltarr(2, IndexTime);
  45 + Density[0,*] = Val
  46 + Density[1,*] = Quality
  47 + Time -= graph[GraphN].TimeBase
  48 + graph[GraphN].DataFlags[Item] = 1
  49 + graph[GraphN].dataTime[Item] = Time[0]
  50 + average, VEX, Time, Density
  51 + endif; else Graph[GraphN].ErrorFlag = 1
  52 +
  53 + cmd = Mission + Product +' = VEX'
  54 + R = execute(cmd)
  55 +
  56 +return
  57 +end
  58 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/get_vexmex_qual.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_vexmex_qual.pro
... ... @@ -0,0 +1,48 @@
  1 +;-------------------- Get THEMIS ION Velocity -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro Get_VexMex_Qual, Mission, Product, st, dt, RESTRICTED = restricted
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common VexHQualCom, VexH
  8 +common VexOQualCom, VexO
  9 +common MexHQualCom, MexH
  10 +common MexOQualCom, MexO
  11 +
  12 + cmd = 'VEX = ' + Mission + Product;
  13 + R = execute(cmd)
  14 +
  15 + sz = Vex.DefSize
  16 +
  17 + Val = fltarr(sz)
  18 + Time = dblarr(sz)
  19 +
  20 + ID = Long(graph[GraphN].DataID[Item])
  21 +
  22 + VI = Mission + ':ima:param';
  23 + if (KEYWORD_SET(RESTRICTED)) then VI = Mission + ':imaparam:restricted';
  24 +
  25 + ParamName = Product eq "h" ? "Quality_P" : "Quality_O";
  26 +
  27 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  28 + ID, VI, ParamName, st, dt, sz, Time, Val)
  29 +
  30 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  31 + if (RetSize GT 1) then begin
  32 + stD = call_external(!DDLIB + 'DD_idl.so','GetDTime', st, /D_VALUE)
  33 + numTime = where(Time GE stD AND Time LE (stD+graph[graphN].DeltaT), IndexTime)
  34 + if IndexTime EQ 0 then return
  35 + Time = temporary(Time[numTime])
  36 + Val = temporary(Val[numTime])
  37 + Time -= graph[GraphN].TimeBase
  38 + graph[GraphN].DataFlags[Item] = 1
  39 + graph[GraphN].dataTime[Item] = Time[0]
  40 + average, VEX, Time, Val
  41 + endif; else Graph[GraphN].ErrorFlag = 1
  42 +
  43 + cmd = Mission + Product +' = VEX'
  44 + R = execute(cmd)
  45 +
  46 +return
  47 +end
  48 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/get_vexmex_scan.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_vexmex_scan.pro
... ... @@ -0,0 +1,46 @@
  1 +;-------------------- Get THEMIS ION Velocity -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro Get_VexMex_Scan, Mission, st, dt, RESTRICTED = restricted
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common VexScanCom, VexScan
  8 +common MexScanCom, MexScan
  9 +
  10 + cmd = 'VEX = ' + Mission + 'Scan';
  11 + R = execute(cmd)
  12 +
  13 + sz = Vex.DefSize
  14 +
  15 + Val = intarr(sz)
  16 + Time = dblarr(sz)
  17 +
  18 + ID = Long(graph[GraphN].DataID[Item])
  19 +
  20 + VI = Mission + ':ima:param';
  21 + if (KEYWORD_SET(RESTRICTED)) then VI = Mission + ':imaparam:restricted';
  22 +
  23 + ParamName = "ScanFlag";
  24 +
  25 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  26 + ID, VI, ParamName, st, dt, sz, Time, Val)
  27 +
  28 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  29 + if (RetSize GT 0) then begin
  30 + stD = call_external(!DDLIB + 'DD_idl.so','GetDTime', st, /D_VALUE)
  31 + numTime = where(Time GE stD AND Time LE (stD+graph[graphN].DeltaT), IndexTime)
  32 + if IndexTime EQ 0 then return
  33 + Time = temporary(Time[numTime])
  34 + Val = temporary(Val[numTime])
  35 + Time -= graph[GraphN].TimeBase
  36 + graph[GraphN].DataFlags[Item] = 1
  37 + graph[GraphN].dataTime[Item] = Time[0]
  38 + immediate, VEX, Time, Val
  39 + endif; else Graph[GraphN].ErrorFlag = 1
  40 +
  41 + cmd = Mission + 'Scan = VEX'
  42 + R = execute(cmd)
  43 +
  44 +return
  45 +end
  46 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/get_vexmex_temp.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_vexmex_temp.pro
... ... @@ -0,0 +1,49 @@
  1 +;-------------------- Get THEMIS ION Velocity -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro Get_VexMex_Temp, Mission, Product, st, dt, RESTRICTED = restricted
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common VexHTempCom, VexH
  8 +common VexOTempCom, VexO
  9 +common MexHTempCom, MexH
  10 +common MexOTempCom, MexO
  11 +
  12 + cmd = 'VEX = ' + Mission + Product;
  13 + R = execute(cmd)
  14 +
  15 + sz = Vex.DefSize
  16 +
  17 + Val = fltarr(3,sz)
  18 + Time = dblarr(sz)
  19 +
  20 + ID = Long(graph[GraphN].DataID[Item])
  21 +
  22 + VI = Mission + ':ima:param'
  23 + if (KEYWORD_SET(RESTRICTED)) then VI = Mission + ':imaparam:restricted';
  24 +
  25 + ParamName = Product eq "h" ? "Temperature_P" : "Temperature_O";
  26 +
  27 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  28 + ID, VI, ParamName, st, dt, sz, Time, Val)
  29 +
  30 +
  31 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  32 + if (RetSize GT 1) then begin
  33 + stD = call_external(!DDLIB + 'DD_idl.so','GetDTime', st, /D_VALUE)
  34 + numTime = where(Time GE stD AND Time LE (stD+graph[graphN].DeltaT), IndexTime)
  35 + if IndexTime EQ 0 then return
  36 + Time = temporary(Time[numTime])
  37 + Val = temporary(Val[*,numTime])
  38 + Time -= graph[GraphN].TimeBase
  39 + graph[GraphN].DataFlags[Item] = 1
  40 + graph[GraphN].dataTime[Item] = Time[0]
  41 + average, VEX, Time, Val
  42 + endif; else Graph[GraphN].ErrorFlag = 1
  43 +
  44 + cmd = Mission + Product +' = VEX'
  45 + R = execute(cmd)
  46 +
  47 +return
  48 +end
  49 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/get_vexmex_vel.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/get_vexmex_vel.pro
... ... @@ -0,0 +1,50 @@
  1 +;-------------------- Get THEMIS ION Velocity -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro Get_VexMex_Vel, Mission, Product, st, dt, RESTRICTED = restricted
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common VexHVelCom, VexH
  8 +common VexOVelCom, VexO
  9 +common MexHVelCom, MexH
  10 +common MexOVelCom, MexO
  11 +
  12 + cmd = 'VEX = ' + Mission + Product;
  13 + R = execute(cmd)
  14 +
  15 + sz = Vex.DefSize
  16 +
  17 + Val = fltarr(3,sz)
  18 + Time = dblarr(sz)
  19 +
  20 + ID = Long(graph[GraphN].DataID[Item])
  21 +
  22 + VI = Mission + ':ima:param'
  23 +
  24 + if (KEYWORD_SET(RESTRICTED)) then VI = Mission + ':imaparam:restricted'
  25 +
  26 + ParamName = Product eq "h" ? "Velocity_P" : "Velocity_O";
  27 +
  28 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  29 + ID, VI, ParamName, st, dt, sz, Time, Val)
  30 +
  31 +
  32 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  33 + if (RetSize GT 1) then begin
  34 + stD = call_external(!DDLIB + 'DD_idl.so','GetDTime', st, /D_VALUE)
  35 + numTime = where(Time GE stD AND Time LE (stD+graph[graphN].DeltaT), IndexTime)
  36 + if IndexTime EQ 0 then return
  37 + Time = temporary(Time[numTime])
  38 + Val = temporary(Val[*,numTime])
  39 + Time -= graph[GraphN].TimeBase
  40 + graph[GraphN].DataFlags[Item] = 1
  41 + graph[GraphN].dataTime[Item] = Time[0]
  42 + average, VEX, Time, Val
  43 + endif; else Graph[GraphN].ErrorFlag = 1
  44 +
  45 + cmd = Mission + Product +' = VEX'
  46 + R = execute(cmd)
  47 +
  48 +return
  49 +end
  50 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/getcdfvar.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getcdfvar.pro
... ... @@ -0,0 +1,63 @@
  1 +function getCdfVar, files, paramName, dims, StartDouble, IntDouble, Time, Data
  2 +
  3 + Size = N_elements(Time);
  4 + TIMESHIFT = 62167219200.D0
  5 + startIndex = 0L;
  6 +
  7 + datapath = getenv("USER_DATA_PATH") eq '' ? '../DATA/' : getenv("USER_DATA_PATH");
  8 +
  9 + for i = 0, n_elements(files) - 1 do begin
  10 +
  11 + fileName = datapath + files[i];
  12 + id = CDF_OPEN(fileName);
  13 +
  14 + CDF_CONTROL, id, SET_ZMODE=2
  15 +
  16 + ; CDF_CONTROL, id, GET_VAR_INFO=info, VARIABLE=0, /ZVARIABLE
  17 + dataType = "UNKNOWN"
  18 + timeId = 0L;
  19 + while (dataType ne "CDF_EPOCH" AND dataType ne "CDF_EPOCH16") do begin
  20 + rest = cdf_varinq(id, timeId, /ZVARIABLE)
  21 + dataType = rest.datatype;
  22 + timeId += 1L;
  23 + endwhile
  24 +
  25 + timeId -= 1L;
  26 + recs = getcdfnbrecs_(FileName, timeId);
  27 +
  28 + ; CDF_CONTROL, id, GET_VAR_INFO=info, VARIABLE=0, /ZVARIABLE
  29 + ;EXTENDRECS MAXALLOCREC MAXREC MAXRECS NINDEXENTRIES NINDEXRECORDS
  30 +
  31 + if (dataType eq "CDF_EPOCH16") then begin
  32 + CDF_VARGET, id, timeId, EPOCH16, REC_COUNT = recs+1, /ZVARIABLE
  33 + EPOCH = dblarr(recs);
  34 + for j = 0, recs -1 do begin
  35 + CDF_EPOCH16, EPOCH16[j], yr, mo, dy, hr, min, sec, milli, micro, pico, /BREAKDOWN_EPOCH
  36 + CDF_EPOCH, EPOCH8, yr, mo, dy, hr, min, sec, milli, /COMPUTE_EPOCH
  37 + EPOCH[j] = EPOCH8;
  38 + endfor
  39 + endif else CDF_VARGET, id, timeId, EPOCH, REC_COUNT = recs+1, /ZVARIABLE
  40 +
  41 + Time1 = reform(EPOCH/1000.D0 - TIMESHIFT)
  42 +
  43 + num = where(Time1 GE StartDouble AND Time1 LT StartDouble+IntDouble, Index);
  44 +
  45 + if ((Index eq 0 AND startIndex eq 0) OR (startIndex + Index gt Size)) then begin
  46 + return, 0
  47 + endif
  48 +
  49 + if (Index gt 0) then begin
  50 + Time[startIndex:startIndex+Index-1] = Time1[num];
  51 +
  52 + varId = CDF_VARNUM(id, paramName);
  53 + CDF_VARGET, id, varId, data1, REC_COUNT = recs+1, /ZVARIABLE
  54 +
  55 + if (dims eq 1) then Data[startIndex:startIndex+Index-1] = reform(Data1[num]) $
  56 + else Data[*, startIndex:startIndex+Index-1] = Data1[*, num]
  57 + endif
  58 + CDF_CLOSE, id
  59 + startIndex += Index;
  60 + endfor
  61 +
  62 + return,startIndex;
  63 +end
... ...
amda_plus/amdalib/getcefvar.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getcefvar.pro
... ... @@ -0,0 +1,48 @@
  1 +function getCefVar, files, paramName, dims, StartDouble, IntDouble, Time, Data
  2 + ; CEF_UNDEF, CEF_INT, CEF_FLOAT, CEF_DOUBLE, CEF_CHAR, CEF_ISO_TIME, CEF_ISO_TIME_RANGE,
  3 +
  4 + Size = N_elements(Time);
  5 + TIMESHIFT = 378691200.D0 ; secs 1970 - 1958
  6 +
  7 + startIndex = 0L;
  8 +
  9 + datapath = getenv("USER_DATA_PATH") eq '' ? '../DATA/' : getenv("USER_DATA_PATH");
  10 +
  11 + for i = 0, n_elements(files) - 1 do begin
  12 +
  13 + fileName = datapath + files[i];
  14 + nrec = CEF_READ(fileName);
  15 + if (nrec LE 0) then continue;
  16 +
  17 + if (i EQ 0) then begin
  18 + dataType = "UNKNOWN"
  19 + timeId = 0L;
  20 + vars = CEF_VARNAMES();
  21 + while (dataType ne "ISO_TIME") do begin
  22 + dataType = CEF_VATTR(vars[timeId],"VALUE_TYPE");
  23 + timeId += 1L;
  24 + endwhile
  25 + timeId -= 1L;
  26 + endif
  27 +
  28 + Time1 = CEF_VAR(vars[timeId])/1000.D0 - TIMESHIFT;
  29 +
  30 + num = where(Time1 GE StartDouble AND Time1 LT StartDouble+IntDouble, Index);
  31 +
  32 + if ((Index eq 0 AND startIndex eq 0) OR (startIndex + Index gt Size)) then return, 0
  33 +
  34 + if (Index gt 0) then begin
  35 + Time[startIndex:startIndex+Index-1] = Time1[num];
  36 +
  37 + Data1 = CEF_VAR(paramName);
  38 + ; dims = CEF_VATTR(paramName, "SIZES")
  39 + dims = n_elements(Data1)/n_elements(Time1);
  40 + if (dims eq 1) then Data[startIndex:startIndex+Index-1] = Data1[num] $
  41 + else Data[*, startIndex:startIndex+Index-1] = Data1[*, num]
  42 + endif
  43 + CEF_CLOSE
  44 + startIndex += Index;
  45 + endfor
  46 +
  47 + return,startIndex;
  48 +end
0 49 \ No newline at end of file
... ...
amda_plus/amdalib/getmex_n_sw.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getmex_n_sw.pro
... ... @@ -0,0 +1,46 @@
  1 +;-------------------- -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro GetMex_N_SW, st, dt
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common Mex_N_SW, Mex
  8 +
  9 +
  10 + sz = Mex.DefSize
  11 +
  12 + Quality = fltarr(sz)
  13 + Val = fltarr(sz)
  14 + Time = dblarr(sz)
  15 +
  16 + ID = Long(graph[GraphN].DataID[Item])
  17 + VI = 'mex:ima:sw'
  18 +
  19 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  20 + ID, VI, 'Flag', st, dt, sz, Time, Quality)
  21 +
  22 +
  23 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  24 + ID, VI, 'N', st, dt, sz, Time, Val)
  25 +
  26 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  27 + if (RetSize GE 1) then begin
  28 + stD = call_external(!DDLIB + 'DD_idl.so','GetDTime', st, /D_VALUE)
  29 + numTime = where(Time GE stD AND Time LE (stD + graph[graphN].DeltaT), IndexTime)
  30 + if IndexTime EQ 0 then return
  31 + Time = temporary(Time[numTime])
  32 + Val = temporary(Val[numTime])
  33 + Quality = temporary(Quality[numTime])
  34 + Density = fltarr(2, IndexTime);
  35 + Density[0,*] = Val
  36 + Density[1,*] = Quality
  37 + Time -= graph[GraphN].TimeBase
  38 + graph[GraphN].DataFlags[Item] = 1
  39 + graph[GraphN].dataTime[Item] = Time[0]
  40 + (*Mex.Time) = N_elements(*Mex.Time) eq 0 ? Time : [*Mex.Time,Time]
  41 + (*Mex.Val) = N_elements(*Mex.Val) eq 0 ? reform(Density,2*IndexTime) : [*Mex.Val,reform(Density,2*IndexTime)]
  42 + endif ;else Graph[GraphN].ErrorFlag = 1
  43 +
  44 +return
  45 +end
  46 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/getmex_v_sw.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getmex_v_sw.pro
... ... @@ -0,0 +1,46 @@
  1 +;-------------------- -------------------------------
  2 +;
  3 +;-----------------------------------------------------------------------------
  4 +pro GetMex_v_SW, st, dt
  5 +
  6 +common GraphC, Graph, GraphN, Item
  7 +common Mex_v_SW, Mex
  8 +
  9 +
  10 + sz = Mex.DefSize
  11 +
  12 + Quality = fltarr(sz)
  13 + Val = fltarr(sz)
  14 + Time = dblarr(sz)
  15 +
  16 + ID = Long(graph[GraphN].DataID[Item])
  17 + VI = 'mex:ima:sw'
  18 +
  19 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  20 + ID, VI, 'Flag', st, dt, sz, Time, Quality)
  21 +
  22 +
  23 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  24 + ID, VI, 'V', st, dt, sz, Time, Val)
  25 +
  26 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  27 + if (RetSize GE 1) then begin
  28 + stD = call_external(!DDLIB + 'DD_idl.so','GetDTime', st, /D_VALUE)
  29 + numTime = where(Time GE stD AND Time LE (stD + graph[graphN].DeltaT), IndexTime)
  30 + if IndexTime EQ 0 then return
  31 + Time = temporary(Time[numTime])
  32 + Val = temporary(Val[numTime])
  33 + Quality = temporary(Quality[numTime])
  34 + Density = fltarr(2, IndexTime);
  35 + Density[0,*] = Val
  36 + Density[1,*] = Quality
  37 + Time -= graph[GraphN].TimeBase
  38 + graph[GraphN].DataFlags[Item] = 1
  39 + graph[GraphN].dataTime[Item] = Time[0]
  40 + (*Mex.Time) = N_elements(*Mex.Time) eq 0 ? Time : [*Mex.Time,Time]
  41 + (*Mex.Val) = N_elements(*Mex.Val) eq 0 ? reform(Density,2*IndexTime) : [*Mex.Val,reform(Density,2*IndexTime)]
  42 + endif ;else Graph[GraphN].ErrorFlag = 1
  43 +
  44 +return
  45 +end
  46 +;-----------------------------------------------------------
... ...
amda_plus/amdalib/getncvar.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getncvar.pro
... ... @@ -0,0 +1,53 @@
  1 +function getNcVar, files, paramName, dims, StartDouble, IntDouble, Time, Data
  2 +
  3 + Size = N_elements(Time);
  4 +
  5 + LastTime = -1;
  6 +
  7 + startIndex = 0L;
  8 + datapath = getenv("USER_DATA_PATH") eq '' ? '../DATA/' : getenv("USER_DATA_PATH");
  9 +
  10 + for i = 0, n_elements(files) - 1 do begin
  11 +
  12 + fileName = datapath + files[i];
  13 + id = NCDF_OPEN(fileName);
  14 +
  15 +
  16 + TimeID = NCDF_VARID(id, 'Time');
  17 + VarID = NCDF_VARID(id, paramName);
  18 +
  19 + res = NCDF_VARINQ(id, VarID);
  20 + dims = res.ndims;
  21 +
  22 + NCDF_VARGET, id, TimeId, Time1
  23 +
  24 + num = where(Time1 GE StartDouble AND Time1 LT StartDouble+IntDouble AND Time1 GT LastTime, Index);
  25 +
  26 + if (Index eq 0 AND startIndex eq 0 AND i eq (n_elements(files) - 1)) then return, 0
  27 +
  28 + stopIndex = startIndex + Index;
  29 +
  30 + if (stopIndex gt Size) then begin
  31 + Time1 = Time1[0:Index-(stopIndex-Size)]
  32 + num = where(Time1 GE StartDouble AND Time1 LT StartDouble+IntDouble, Index);
  33 + stopIndex = Size ;
  34 + endif
  35 +
  36 + if (Index GT 0) then begin
  37 + Time[startIndex:stopIndex-1] = Time1[num];
  38 +
  39 + NCDF_VARGET, id, VarId, data1
  40 +
  41 + if (dims eq 1) then Data[startIndex:stopIndex-1] = reform(Data1[num]) $
  42 + else Data[*, startIndex:stopIndex-1] = Data1[*, num]
  43 +
  44 + endif
  45 +
  46 + NCDF_CLOSE, id
  47 + startIndex += Index;
  48 + LastTime = Time[stopIndex-1]
  49 + endfor
  50 +
  51 + return, startIndex;
  52 +
  53 +end
0 54 \ No newline at end of file
... ...
amda_plus/amdalib/getros_lap_sweep.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getros_lap_sweep.pro
... ... @@ -0,0 +1,60 @@
  1 +; $Id: getlocalparam.pro,v 1.5 2011/09/21 16:01:45 budnik Exp $
  2 +;--------------------------------------
  3 +; GETNEWPARAM - TEMPLATE
  4 +;
  5 +; Fri Sep 21 11:57:01 CEST 2007
  6 +;
  7 +;---------------------------------------
  8 +
  9 + pro GETros_lap_sweep, LAP, st, dt
  10 +
  11 +
  12 +common ros_lap1_sweep_Common, Final1
  13 +common ros_lap2_sweep_Common, Final2
  14 +common GraphC, graph, GraphN, Item
  15 +
  16 + cmd = 'Final = Final'+string(LAP,format='(i1)')
  17 + R = execute(cmd);
  18 +
  19 + paramName = 'full_sweep';
  20 +
  21 + VI = 'ros:lap'+string(LAP,format='(i1)')+':sweep';
  22 + ID = Graph[GraphN].DataID[Item];
  23 +
  24 + Size = Final.DefSize
  25 + flag = intarr(size);
  26 + Time = dblarr(size);
  27 +
  28 +
  29 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  30 + ID, VI, 'macros', st, dt, size, Time, flag);
  31 +
  32 + if (RetSize GT 1) then begin
  33 + flag = temporary(flag[0:RetSize-1]);
  34 +
  35 + dims = 241L;
  36 + Data = fltarr(dims,retSize);
  37 + Time = temporary(Time[0:retSize-1]);
  38 + Data1 = replicate(Graph[GraphN].FillValue[Item], (dims+1L)*retSize);
  39 +
  40 + RetSize = call_external(!PROJLIB + '/libParam.so', 'getLocalData', $
  41 + ID, VI, paramName, st, dt, size, Time, Data);
  42 +
  43 +
  44 + Data1 = temporary(reform(Data1,dims+1L,Retsize));
  45 + Data1[0:dims-1, *] = Data[*, 0:Retsize - 1];
  46 +
  47 + Data1[dims,*] = float(flag);
  48 + Time = Time - graph[GraphN].TimeBase;
  49 + graph[GraphN].DataFlags[Item] = 1;
  50 + graph[GraphN].dataTime[Item] = Time[0];
  51 +
  52 + averagelap, Final, Time[ 0:Retsize - 1],Data1
  53 +
  54 + endif; else Graph[GraphN].ErrorFlag = 1;
  55 +
  56 + cmd = 'Final'+string(LAP,format='(i1)')+ ' = Final'
  57 + R = execute(cmd)
  58 +
  59 +return
  60 +end
... ...
amda_plus/amdalib/getros_mip_surv.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getros_mip_surv.pro
... ... @@ -0,0 +1,55 @@
  1 +; $Id: getlocalparam.pro,v 1.5 2011/09/21 16:01:45 budnik Exp $
  2 +;--------------------------------------
  3 +; GETNEWPARAM - TEMPLATE
  4 +;
  5 +; Fri Sep 21 11:57:01 CEST 2007
  6 +;
  7 +;---------------------------------------
  8 +
  9 + pro GETros_mip_surv, st, dt
  10 +
  11 +
  12 +common ros_mip_surv_Common, Final
  13 +common GraphC, graph, GraphN, Item
  14 +
  15 + paramName = 'SurveyFull';
  16 + dims = 92L;
  17 + VI = 'ros:mip:surv';
  18 + Size = Final.DefSize
  19 +
  20 +
  21 + Data = fltarr(dims,size);
  22 + flag = lonarr(size);
  23 + Time = dblarr(size)
  24 + Data1 = fltarr(dims+1,size);
  25 +
  26 + ID = Long(graph[GraphN].DataID[Item])
  27 + Lag = Graph[GraphN].Lag[0];
  28 + Sampling = Graph[GraphN].Sampling[Item];
  29 +
  30 + if (Lag ne 0.0) then begin
  31 + rt = call_external(!DDLIB+'DD_idl.so', 'GetDTime', st, /D_VALUE)
  32 + rt -= Lag
  33 + st = call_external(!DDLIB+'DD_idl.so', 'GetTime', double(rt), /S_VALUE)
  34 + endif
  35 +
  36 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  37 + ID, VI, paramName, st, dt, size, Time, Data)
  38 +
  39 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  40 + ID, VI, 'Frequency_table_idx', st, dt, size, Time, flag)
  41 +
  42 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  43 +
  44 + if (RetSize GT 1) then begin
  45 + Data1[0:dims-1, 0:RetSize-1] = Data[*,0:RetSize-1];
  46 + Data1[dims, 0:RetSize-1] = float(flag[0:RetSize-1]);
  47 +
  48 + Time = Time - graph[GraphN].TimeBase + Lag;
  49 + graph[GraphN].DataFlags[Item] = 1;
  50 + graph[GraphN].dataTime[Item] = Time[0];
  51 + average, Final, Time[0:RetSize-1], Data1[*,0:RetSize-1]
  52 + endif; else Graph[GraphN].ErrorFlag = 1;
  53 +
  54 +return
  55 +end
... ...
amda_plus/amdalib/getros_mip_survphase.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/getros_mip_survphase.pro
... ... @@ -0,0 +1,55 @@
  1 +; $Id: getlocalparam.pro,v 1.5 2011/09/21 16:01:45 budnik Exp $
  2 +;--------------------------------------
  3 +; GETNEWPARAM - TEMPLATE
  4 +;
  5 +; Fri Sep 21 11:57:01 CEST 2007
  6 +;
  7 +;---------------------------------------
  8 +
  9 + pro GETros_mip_survphase, st, dt
  10 +
  11 +
  12 +common ros_mip_survphase_Common, Final
  13 +common GraphC, graph, GraphN, Item
  14 +
  15 + paramName = 'SurveyFull_Phase';
  16 + dims = 92L;
  17 + VI = 'ros:mip:survphase';
  18 + Size = Final.DefSize
  19 +
  20 +
  21 + Data = fltarr(dims,size);
  22 + flag = lonarr(size);
  23 + Time = dblarr(size)
  24 + Data1 = fltarr(dims+1,size);
  25 +
  26 + ID = Long(graph[GraphN].DataID[Item])
  27 + Lag = Graph[GraphN].Lag[0];
  28 + Sampling = Graph[GraphN].Sampling[Item];
  29 +
  30 + if (Lag ne 0.0) then begin
  31 + rt = call_external(!DDLIB+'DD_idl.so', 'GetDTime', st, /D_VALUE)
  32 + rt -= Lag
  33 + st = call_external(!DDLIB+'DD_idl.so', 'GetTime', double(rt), /S_VALUE)
  34 + endif
  35 +
  36 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  37 + ID, VI, 'Frequency_table_idx', st, dt, size, Time, flag)
  38 +
  39 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  40 + ID, VI, paramName, st, dt, size, Time, Data)
  41 +
  42 + if (ID GE 0) then Graph[GraphN].DataID[Item] = ID
  43 +
  44 + if (RetSize GT 1) then begin
  45 + Data1[0:dims-1, 0:RetSize-1] = Data[*,0:RetSize-1];
  46 + Data1[dims, 0:RetSize-1] = float(flag[0:RetSize-1]);
  47 +
  48 + Time = Time - graph[GraphN].TimeBase + Lag;
  49 + graph[GraphN].DataFlags[Item] = 1;
  50 + graph[GraphN].dataTime[Item] = Time[0];
  51 + averagemip, Final, Time[0:RetSize-1], Data1[*,0:RetSize-1]
  52 + endif ; else Graph[GraphN].ErrorFlag = 1;
  53 +
  54 +return
  55 +end
... ...
amda_plus/amdalib/gettxtvar.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/gettxtvar.pro
... ... @@ -0,0 +1,40 @@
  1 +function getTxtVar, files, paramName, dims, StartDouble, IntDouble, Time, Data
  2 +
  3 + Size = N_elements(Time);
  4 +
  5 + startIndex = 0L;
  6 + i_start = long(paramName);
  7 + i_stop = i_start + dims - 1;
  8 +
  9 + datapath = getenv("USER_DATA_PATH") eq '' ? '../DATA/' : getenv("USER_DATA_PATH");
  10 + for i = 0, n_elements(files) - 1 do begin
  11 + ; print, i, "FILENEME", files[i]
  12 + openr, LUN, datapath+files[i], err = err, /GET_LUN ;
  13 + temp = " ";
  14 +
  15 + while not EOF(LUN) do begin
  16 + readf, LUN, temp
  17 + arr = strsplit(temp, " ", /EXTRACT);
  18 + Time1 = N_Elements(Time1) eq 0 ? double(arr[0]) : [Time1,double(arr[0])];
  19 + Data1 = N_Elements(Data1) eq 0 ? float(arr[i_start:i_stop]) : [Data1, float(arr[i_start:i_stop])]
  20 + endwhile
  21 +
  22 + close,LUN
  23 + free_lun,LUN
  24 + endfor
  25 +
  26 + num = where(Time1 GE StartDouble AND Time1 LT StartDouble+IntDouble, Index);
  27 + ; print, "INDEX ",Index, " SIZE ", Size, " INDEX+ ", startIndex + Index
  28 + if ((Index eq 0 AND startIndex eq 0) OR (startIndex + Index gt Size)) then return, 0;
  29 +
  30 + if (Index GT 0) then begin
  31 + Time[startIndex:startIndex+Index-1] = Time1[num];
  32 + if (dims eq 1) then Data[startIndex:startIndex+Index-1] = reform(Data1[num]) $
  33 + else begin
  34 + Data1 = reform(Data1,dims,N_elements(Time1))
  35 + Data[*, startIndex:startIndex+Index-1] = Data1[*, num]
  36 + endelse
  37 + endif
  38 + startIndex += Index;
  39 + return, startIndex;
  40 +end
0 41 \ No newline at end of file
... ...
amda_plus/amdalib/ica_spec_com.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/ica_spec_com.pro
... ... @@ -0,0 +1,57 @@
  1 +;===========================================================
  2 +;
  3 +;===================== ========================================
  4 +pro ica_spec_com
  5 +
  6 +common IcaSpecCom, Spec
  7 +common GraphC, graph, GraphN, Item
  8 +common Etab, Flag, Tab
  9 +Common Record, Record
  10 +
  11 + if (N_ELEMENTS(Flag) eq 0) then Flag = GraphN
  12 +
  13 + FillValue = !Values.F_NAN
  14 + Sampling = 192.0
  15 + Sz = Long((Graph[GraphN].DeltaT)/Sampling + 1)
  16 +
  17 + Spec = record
  18 + Spec.DefSize = long(Graph[GraphN].DeltaT/Sampling + 1)
  19 + Spec.Sampling = Sampling
  20 + Graph[GraphN].FillValue[Item] = FillValue
  21 + ; Graph[GraphN].Lag[Item] = double(Delay)
  22 +
  23 + Spec.Time = PTR_NEW(/ALLOCATE_HEAP)
  24 + Spec.Val = PTR_NEW(/ALLOCATE_HEAP)
  25 + Spec.LastTime = PTR_NEW(/ALLOCATE_HEAP)
  26 + Spec.LastVal = PTR_NEW(/ALLOCATE_HEAP)
  27 +
  28 + if (Flag eq GraphN) then begin
  29 + Tab = record;
  30 + Tab.DefSize = long(Graph[GraphN].DeltaT/Sampling + 1)
  31 + Tab.Sampling = Sampling
  32 +
  33 + Tab.Time = PTR_NEW(/ALLOCATE_HEAP)
  34 + Tab.Val = PTR_NEW(/ALLOCATE_HEAP)
  35 + Tab.LastTime = PTR_NEW(/ALLOCATE_HEAP)
  36 + Tab.LastVal = PTR_NEW(/ALLOCATE_HEAP)
  37 + Flag = GraphN;
  38 + endif
  39 +
  40 + Graph[GraphN].Sampling[Item] = Sampling
  41 + Graph[GraphN].Time[Item] = Spec.Time
  42 + Graph[GraphN].Val[Item] = Spec.Val
  43 +
  44 + if (Graph[GraphN].Step GT Sampling*2.0) then begin
  45 + *(Spec.Time) = indgen(Graph[GraphN].ppp)*Graph[GraphN].Step + Graph[GraphN].Step/2.0
  46 + *(Spec.Val) = replicate(FillValue, 16L*96L*16L*Graph[GraphN].ppp)
  47 + if (Flag eq GraphN) then begin
  48 + *(Tab.Time) = indgen(Graph[GraphN].ppp)*Graph[GraphN].Step + Graph[GraphN].Step/2.0
  49 + *(Tab.Val) = replicate(FillValue, Graph[GraphN].ppp)
  50 + endif
  51 + endif
  52 +
  53 +
  54 +return
  55 +end
  56 +;------------------------------------------------------------
  57 +
... ...
amda_plus/amdalib/icacntplot.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/icacntplot.pro
... ... @@ -0,0 +1,104 @@
  1 +pro icacntplot, azMin, azMax, enMin, enMax, elevation
  2 +
  3 + common GraphC, Graph, GraphN, Item
  4 + common Etab, Flag, ETab
  5 +
  6 + ;------- Energy table -----------------
  7 +
  8 + Tab = fix(*ETab[0].val);
  9 + VI = "ros:ica:all";
  10 + ID = Long(graph[GraphN].DataID[Item]);
  11 + EnNum = 96
  12 + Energy = fltarr(EnNum)
  13 + numTab = uniq(Tab,sort(Tab));
  14 + uniqTab = Tab[numTab];
  15 + temp = fltarr(96L,2L);
  16 +
  17 +
  18 + err = call_external(!PROJLIB + '/libParam.so', 'getInfo', $
  19 + ID, VI, "Energy", 2L*96L, temp)
  20 +
  21 + Energy = temp[*, uniqTab[0]];
  22 + Energy = temporary(Energy(where(Energy GT 0)));
  23 + EnNum = N_elements(Energy)
  24 +
  25 + ;-------- Cat in the Energy range ------------
  26 + E0 = min(Energy)
  27 + E1 = max(Energy)
  28 + eindex = where((Energy GE E0) AND $
  29 + (Energy LE E1) AND $
  30 + (Energy GT 0.0),counte)
  31 + if counte GT 0 then begin
  32 + EBounds = fltarr(EnNum+1)
  33 + EBounds(min(eindex)) = Energy(min(eindex))
  34 + EBounds(max(eindex+1)) = Energy(max(eindex))
  35 + for ie = min(eindex+1), max(eindex) do EBounds(ie) = sqrt(Energy(ie-1)*Energy(ie))
  36 + endif else return
  37 +
  38 +;--------------------- No DATA - just axes -----------------------
  39 + if (N_Elements(*Graph[GraphN].Time[0]) eq 0) then begin
  40 + nodata
  41 + return
  42 + endif
  43 +
  44 +
  45 + Time = (*Graph[GraphN].Time[0])
  46 +
  47 + Val = (*Graph[GraphN].Val[0])
  48 + N_Time = N_elements(Time);
  49 +
  50 +
  51 + if (elevation) then begin
  52 + Val = temporary(reform(Val, 96, 16, 16, N_Time))
  53 + LocVal = azMax GT azMin ? total(total(Val[*, azMin:azMax, 0:15, *],2),2) : reform(total(Val[*,azMin,0:15,*],3), 96, N_time);
  54 + newTime = Time;
  55 + deltaT = 96.0;
  56 + gapT = deltaT*10.0 ;
  57 + endif else begin
  58 +; elevation as TIME
  59 + newTime = dblarr(N_Time*16);
  60 + for i = 0, N_Time - 1 do for j = 0, 15 do newTime[i*16 + j] = Time[i] + j*12.D0
  61 + N_Time *= 16;
  62 + Val = temporary(reform(Val, 96, 16, N_Time));
  63 + LocVal = azMax GT azMin ? total(Val[*,azMin:azMax,*],2) : reform(Val[*,azMin,*], 96, N_time);
  64 + deltaT = 6.0;
  65 + gapT = deltaT*10.0;
  66 + endelse
  67 +
  68 + num0 = where(EBounds ge enMin, Index0);
  69 + num1 = where(EBounds ge enMax, Index1);
  70 +
  71 + if (Index1 eq 0) then numStop = 0 else numStop = num1[Index1-1];
  72 + if (Index0 eq EnNum+1) then numStart = 95 else numStart = num0[Index0-1];
  73 +
  74 + Data = numStart ne numStop ? total(LocVal[numStop:numStart,*],1) : reform(LocVal[numStart,*], N_Time);
  75 + numMinMax = where(finite(Data), IndexMinMax)
  76 +
  77 + MinVal = min(Data[numMinMax]) > 0.1;
  78 + MaxVal = max(Data[numMinMax]);
  79 +
  80 +
  81 + if Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] then begin
  82 + Graph[GraphN].Ly.range = Graph[GraphN].AxisF eq 'logaxis' ? [MinVal, MaxVal] : [0.0, MaxVal]
  83 + Graph[GraphN].Ly.style = 0
  84 + endif else Graph[GraphN].Ly.style = 1
  85 +
  86 + !y = Graph[GraphN].Ly;
  87 +
  88 + if (execute(Graph[GraphN].AxisF) NE 1) then plot, newTime, Data, MAX_VALUE=MaxValue, color = !dnc-1, /NODATA, /NOERASE
  89 +
  90 + plots, newTime[0]+deltaT, Data[0], /DATA
  91 +
  92 + for i = 1, N_elements(newTime) - 1 do begin
  93 + if (newTime[i] LE Graph[GraphN].TotalTime) then begin
  94 + if (data[i] lt Graph[GraphN].Ly.range[0]) then data[i] = Graph[GraphN].Ly.range[0];
  95 + if (data[i] gt Graph[GraphN].Ly.range[1]) then data[i] = Graph[GraphN].Ly.range[1];
  96 + if (newTime[i] - newTime[i-1] LE gapT) then $
  97 + plots, newTime[i]+deltaT, data[i], color=col, /CONTINUE, /DATA $
  98 + else plots, newTime[i]+deltaT, data[i], /DATA
  99 + endif
  100 + endfor
  101 +
  102 +return
  103 +end
  104 +;--------------------------------------------------------------------
... ...
amda_plus/amdalib/icaspecplot.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/icaspecplot.pro
... ... @@ -0,0 +1,186 @@
  1 +;============================================================
  2 +;
  3 +;=============================================================
  4 +
  5 +pro icaspecplot, AzMin, AzMax, elevation, minCount, maxCount
  6 +
  7 + common GraphC, Graph, GraphN, Item
  8 + common Etab, Flag, ETab
  9 +
  10 + ;------- Energy table -----------------
  11 +
  12 + VI = "ros:ica:all";
  13 + ID = Long(graph[GraphN].DataID[Item])
  14 +
  15 + EnNum0 = 96
  16 + Energy = fltarr(EnNum0);
  17 + Energy1 = fltarr(EnNum0);
  18 +; set min/max energy
  19 + EnergyMin = 40000.0;
  20 + EnergyMax = 0.0;
  21 +
  22 + if (n_elements(*ETab[0].val) eq 0) then begin
  23 + !y = Graph[GraphN].Ly
  24 + plot_io, graph[GraphN].Lx.range, [1., 40000.0], /nodata, /noerase, ystyle = 1, $
  25 + ytickformat='yticks', charsize=graph[GraphN].Lp.charsize*0.8, color = !dnc-1
  26 + nodatafortimeinterval
  27 + return
  28 + endif
  29 +
  30 + Tab = fix(*ETab[0].val);
  31 + numTab = uniq(Tab,sort(Tab));
  32 + uniqTab = Tab[numTab];
  33 + temp = fltarr(96L,2L);
  34 +
  35 +
  36 + err = call_external(!PROJLIB + '/libParam.so', 'getInfo', $
  37 + ID, VI, "Energy", 2L*96L, temp)
  38 +
  39 + for i = 0, N_elements(uniqTab) - 1 do begin
  40 + if uniqTab[i] lt 0 then continue;
  41 + Energy1 = temp[*, uniqTab[i]]
  42 + Energy1 = temporary(Energy1(where(Energy1 GT 0)));
  43 + if (min(Energy1) LT EnergyMin) then EnergyMin = min(Energy1);
  44 + if (max(Energy1) GT EnergyMax) then EnergyMax = max(Energy1);
  45 + endfor
  46 +
  47 + Energy = temp[*, uniqTab[0]]
  48 + Energy = temporary(Energy(where(Energy GT 0)));
  49 + EnNum = N_elements(Energy)
  50 +
  51 + ;-------- Cat in the Energy range ------------
  52 + E0 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? min(Energy) : Graph[GraphN].Ly.range[0]
  53 + E1 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? max(Energy) : Graph[GraphN].Ly.range[1]
  54 +
  55 + eindex = where((Energy GE E0) AND $
  56 + (Energy LE E1) AND $
  57 + (Energy GT 0.0),counte)
  58 +
  59 + if counte GT 0 then begin
  60 + EBounds = fltarr(EnNum+1)
  61 + EBounds(min(eindex)) = Energy(min(eindex))
  62 + EBounds(max(eindex+1)) = Energy(max(eindex))
  63 + for ie = min(eindex+1), max(eindex) do EBounds[ie] = sqrt(Energy[ie-1]*Energy[ie])
  64 + endif else begin
  65 + !y = Graph[GraphN].Ly
  66 + plot_io, graph[GraphN].Lx.range, [1., 40000.0], /nodata, /noerase, ystyle = 1, $
  67 + ytickformat='yticks', charsize=graph[GraphN].Lp.charsize*0.8, color = !dnc-1
  68 + nodatafortimeinterval
  69 + return
  70 + endelse
  71 +
  72 +;--------------------- No DATA - just axes -----------------------
  73 + if (N_Elements(*Graph[GraphN].Time[0]) eq 0) then begin
  74 + nodata
  75 + return
  76 + endif
  77 +
  78 + Time = (*Graph[GraphN].Time[0])
  79 +
  80 + Val = (*Graph[GraphN].Val[0])
  81 + N_Time = N_elements(Time);
  82 +
  83 + if (elevation) then begin
  84 + Val = temporary(reform(Val, 96, 16, 16, N_Time))
  85 + LocVal = azMax GT azMin ? total(total(Val[*, azMin:azMax, 0:15, *],2),2) : reform(total(Val[*,azMin,0:15,*],3), 96, N_time);
  86 + newTime = Time;
  87 + endif else begin
  88 +; elevation as TIME
  89 + newTime = dblarr(N_Time*16);
  90 + for i = 0, N_Time - 1 do for j = 0, 15 do newTime[i*16 + j] = Time[i] + j*12.D0
  91 + N_Time *= 16;
  92 + Val = temporary(reform(Val, 96, 16, N_Time));
  93 + LocVal = azMax GT azMin ? total(Val[*,azMin:azMax,*],2) : reform(Val[*,azMin,*], 96, N_time);
  94 + endelse
  95 +
  96 +
  97 + numMinMax = where(LocVal gt 0.0, IndexMinMax)
  98 +
  99 +
  100 + if (Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1]) then $
  101 + Graph[GraphN].Ly.range = [EnergyMin, EnergyMax]
  102 +
  103 + Graph[GraphN].Ly.style = 1
  104 +
  105 + !y = Graph[GraphN].Ly
  106 +
  107 + plot_io, graph[GraphN].Lx.range, graph[GraphN].Ly.range, /nodata, /noerase, ystyle = 1, $
  108 + ytickformat='yticks', charsize=graph[GraphN].Lp.charsize*0.8, color = !dnc-1
  109 +
  110 + Step = Graph[GraphN].Sampling[0] > Graph[GraphN].Step;
  111 + if (not elevation) then Step /= 16.0;
  112 +
  113 + ;--------------------- No DATA - just axes -----------------------
  114 + if (IndexMinMax LE 0) then begin
  115 + nodatafortimeinterval
  116 + return
  117 + endif
  118 + if (Time[0] GT Graph[GraphN].TotalTime) then begin
  119 + nodatafortimeinterval
  120 + return
  121 + endif
  122 +
  123 + MinVal = (MinCount ge 0) ? MinCount > 0.1: min(Val[numMinMax]) > 0.1
  124 + MaxVal = (MaxCount ge 0) ? MaxCount : max(Val[numMinMax])
  125 +
  126 + ; MinVal = min(LocVal[numMinMax]) > 0.1
  127 + ; MaxVal = max(LocVal[numMinMax])
  128 +
  129 + ;----------- NOW PLOT SPECTRA
  130 + alogMin = alog(MinVal)
  131 + KF = float(!DNC - 2) /(alog(MaxVal) - alogMin)
  132 + xx = fltarr(4) & yy = fltarr(4)
  133 +
  134 + for i = 0, N_Time - 2 do begin
  135 +
  136 + ii = elevation ? i : i/16 < (N_elements(Tab) - 2);
  137 +
  138 + if (Tab[ii+1] ne Tab[ii] AND Tab[ii+1] GE 0) then begin
  139 + Energy = temp[*,Tab[ii+1]]
  140 + Energy = temporary(Energy(where(Energy GT 0)));
  141 + EnNum = N_elements(Energy)
  142 +
  143 + ;-------- Cat in the Energy range ------------
  144 + E0 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? min(Energy) : Graph[GraphN].Ly.range[0]
  145 + E1 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? max(Energy) : Graph[GraphN].Ly.range[1]
  146 + eindex = where((Energy GE E0) AND $
  147 + (Energy LE E1) AND $
  148 + (Energy GT 0.0),counte)
  149 + if counte GT 0 then begin
  150 + EBounds = fltarr(EnNum+1)
  151 + EBounds(min(eindex)) = Energy(min(eindex))
  152 + EBounds(max(eindex+1)) = Energy(max(eindex))
  153 + for ie = min(eindex+1), max(eindex) do EBounds(ie) = sqrt(Energy(ie-1)*Energy(ie))
  154 + endif else return
  155 + endif
  156 + xx[0] = newTime[i] > 0.0
  157 + xx[1] = xx[0]
  158 + xx[2] = newTime[i+1] < newTime[i] + Step
  159 + xx[3] = xx[2]
  160 +
  161 + if (xx[2] LE graph[GraphN].TotalTime AND xx[0] LT graph[GraphN].TotalTime) then begin
  162 + for k = min(eindex), max(eindex) do begin
  163 + yy[0] = EBounds[k]
  164 + yy[1] = EBounds[k+1]
  165 + yy[2] = yy[1]
  166 + yy[3] = yy[0]
  167 + lcount = LocVal[k,i] ;< 1.e5
  168 + if finite(lcount) then begin
  169 + cl = lcount GT MinVal ? fix(KF*(alog(lcount) - alogMin)) : 1;
  170 + endif else cl = 0;
  171 +
  172 + if (cl GT !DNC - 2) then cl = !DNC - 2
  173 + PolyFill, xx ,yy, color = cl, /data
  174 + endfor
  175 + endif
  176 + endfor
  177 +
  178 +;-------------------- Legend ----------------------------------------
  179 + spec_legend, MinVal, MaxVal
  180 +;------------------ MIN-MAX------------------------------------------------
  181 + Graph[GraphN].Min = MinVal
  182 + Graph[GraphN].Max = MaxVal
  183 +
  184 +return
  185 +end
  186 +;--------------------------------------------------------------------
... ...
amda_plus/amdalib/ima_h_spec_com.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/ima_h_spec_com.pro
... ... @@ -0,0 +1,72 @@
  1 +;===========================================================
  2 +;
  3 +; VEX_H_SPEC COM
  4 +; 18 Mars 2009
  5 +;===================== ========================================
  6 +pro ima_h_spec_com, Mission
  7 +
  8 +common VexHSpecCom, VexHSpec
  9 +common MexHSpecCom, MexHSpec
  10 +
  11 +common GraphC, graph, GraphN, Item
  12 +Common Record, Record
  13 +common Etab, FlagVex, EtabVex, FlagMex, EtabMex
  14 +
  15 +
  16 + if (Mission eq 'vex') then begin
  17 + if (N_ELEMENTS(FlagVex) eq 0) then Flag = GraphN $
  18 + else Flag = FlagVex;
  19 + endif else begin
  20 + if (N_ELEMENTS(FlagMex) eq 0) then Flag = GraphN $
  21 + else Flag = FlagMex;
  22 + endelse
  23 +
  24 + FillValue = !Values.F_NAN
  25 + Sampling = 192.0
  26 + Sz = Long((Graph[GraphN].DeltaT)/Sampling + 1)
  27 +
  28 + Spec = record
  29 + Spec.DefSize = long(Graph[GraphN].DeltaT/Sampling + 1)
  30 + Spec.Sampling = Sampling
  31 + Graph[GraphN].FillValue[Item] = FillValue
  32 + ; Graph[GraphN].Lag[Item] = double(Delay)
  33 +
  34 + Spec.Time = PTR_NEW(/ALLOCATE_HEAP)
  35 + Spec.Val = PTR_NEW(/ALLOCATE_HEAP)
  36 + Spec.LastTime = PTR_NEW(/ALLOCATE_HEAP)
  37 + Spec.LastVal = PTR_NEW(/ALLOCATE_HEAP)
  38 +
  39 + Graph[GraphN].Sampling[Item] = Sampling
  40 + Graph[GraphN].Time[Item] = Spec.Time
  41 + Graph[GraphN].Val[Item] = Spec.Val
  42 +
  43 + if (Flag eq GraphN) then begin
  44 + Tab = record;
  45 + Tab.DefSize = long(Graph[GraphN].DeltaT/Sampling + 1)
  46 + Tab.Sampling = Sampling
  47 +
  48 + Tab.Time = PTR_NEW(/ALLOCATE_HEAP)
  49 + Tab.Val = PTR_NEW(/ALLOCATE_HEAP)
  50 + Tab.LastTime = PTR_NEW(/ALLOCATE_HEAP)
  51 + Tab.LastVal = PTR_NEW(/ALLOCATE_HEAP)
  52 + Flag = GraphN;
  53 + endif
  54 +
  55 + if (Graph[GraphN].Step GT Sampling*2.0) then begin
  56 + *(Spec.Time) = indgen(Graph[GraphN].ppp)*Graph[GraphN].Step + Graph[GraphN].Step/2.0
  57 + *(Spec.Val) = replicate(FillValue, 16L*96L*16L*Graph[GraphN].ppp)
  58 + if (Flag eq GraphN) then begin
  59 + *(Tab.Time) = indgen(Graph[GraphN].ppp)*Graph[GraphN].Step + Graph[GraphN].Step/2.0
  60 + *(Tab.Val) = replicate(FillValue, Graph[GraphN].ppp)
  61 + endif
  62 + endif
  63 +
  64 + if (Flag eq GraphN) then cmd = Mission + 'HSpec = Spec & Etab' + Mission +'= Tab & Flag'+ Mission +'= Flag' $
  65 + else cmd = Mission + 'HSpec = Spec';
  66 +
  67 + R = execute(cmd);
  68 +
  69 +return
  70 +end
  71 +;------------------------------------------------------------
  72 +
... ...
amda_plus/amdalib/ima_o_spec_com.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/ima_o_spec_com.pro
... ... @@ -0,0 +1,70 @@
  1 +;===========================================================
  2 +;
  3 +; VEX_o_SPEC COM
  4 +; 18 Mars 2009
  5 +;===================== ========================================
  6 +pro ima_o_spec_com, Mission
  7 +
  8 +common VexOSpecCom, VexOSpec
  9 +common MexOSpecCom, MexOSpec
  10 +common GraphC, graph, GraphN, Item
  11 +common Etab, FlagVex, EtabVex, FlagMex, EtabMex
  12 +Common Record, Record
  13 +
  14 + if (Mission eq 'vex') then begin
  15 + if (N_ELEMENTS(FlagVex) eq 0) then Flag = GraphN $
  16 + else Flag = FlagVex;
  17 + endif else begin
  18 + if (N_ELEMENTS(FlagMex) eq 0) then Flag = GraphN $
  19 + else Flag = FlagMex;
  20 + endelse
  21 +
  22 + FillValue = !Values.F_NAN
  23 + Sampling = 192.0
  24 + Sz = Long((Graph[GraphN].DeltaT)/Sampling + 1)
  25 +
  26 + Spec = record
  27 + Spec.DefSize = long(Graph[GraphN].DeltaT/Sampling + 1)
  28 + Spec.Sampling = Sampling
  29 + Graph[GraphN].FillValue[Item] = FillValue
  30 + ; Graph[GraphN].Lag[Item] = double(Delay)
  31 +
  32 + Spec.Time = PTR_NEW(/ALLOCATE_HEAP)
  33 + Spec.Val = PTR_NEW(/ALLOCATE_HEAP)
  34 + Spec.LastTime = PTR_NEW(/ALLOCATE_HEAP)
  35 + Spec.LastVal = PTR_NEW(/ALLOCATE_HEAP)
  36 +
  37 + if (Flag eq GraphN) then begin
  38 + Tab = record;
  39 + Tab.DefSize = long(Graph[GraphN].DeltaT/Sampling + 1)
  40 + Tab.Sampling = Sampling
  41 +
  42 + Tab.Time = PTR_NEW(/ALLOCATE_HEAP)
  43 + Tab.Val = PTR_NEW(/ALLOCATE_HEAP)
  44 + Tab.LastTime = PTR_NEW(/ALLOCATE_HEAP)
  45 + Tab.LastVal = PTR_NEW(/ALLOCATE_HEAP)
  46 + Flag = GraphN;
  47 + endif
  48 +
  49 + Graph[GraphN].Sampling[Item] = Sampling
  50 + Graph[GraphN].Time[Item] = Spec.Time
  51 + Graph[GraphN].Val[Item] = Spec.Val
  52 +
  53 + if (Graph[GraphN].Step GT Sampling*2.0) then begin
  54 + *(Spec.Time) = indgen(Graph[GraphN].ppp)*Graph[GraphN].Step + Graph[GraphN].Step/2.0
  55 + *(Spec.Val) = replicate(FillValue, 16L*96L*16L*Graph[GraphN].ppp)
  56 + if (Flag eq GraphN) then begin
  57 + *(Tab.Time) = indgen(Graph[GraphN].ppp)*Graph[GraphN].Step + Graph[GraphN].Step/2.0
  58 + *(Tab.Val) = replicate(FillValue, Graph[GraphN].ppp)
  59 + endif
  60 + endif
  61 +
  62 + if (Flag eq GraphN) then cmd = Mission + 'OSpec = Spec & Etab' + Mission +'= Tab & Flag'+ Mission +'= Flag' $
  63 + else cmd = Mission + 'OSpec = Spec';
  64 +
  65 + R = execute(cmd);
  66 +
  67 +return
  68 +end
  69 +;------------------------------------------------------------
  70 +
... ...
amda_plus/amdalib/imacntplot.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/imacntplot.pro
... ... @@ -0,0 +1,93 @@
  1 +pro imacntplot, Mission, azMin, azMax, enMin, enMax, elevation
  2 +
  3 + common GraphC, Graph, GraphN, Item
  4 + common Etab, FlagVex, EtabVex, FlagMex, EtabMex
  5 +
  6 + ;------- Energy table -----------------
  7 + if (Mission eq 'vex') then Tab = fix(*EtabVex[0].val) else Tab = fix(*EtabMex[0].val);
  8 + EnNum = 96
  9 + Energy = fltarr(EnNum)
  10 +
  11 + RetSize = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy, Tab[0])
  12 + Energy = temporary(Energy(where(Energy GT 0)));
  13 + EnNum = N_elements(Energy)
  14 +
  15 + ;-------- Cat in the Energy range ------------
  16 + E0 = min(Energy)
  17 + E1 = max(Energy)
  18 + eindex = where((Energy GE E0) AND $
  19 + (Energy LE E1) AND $
  20 + (Energy GT 0.0),counte)
  21 + if counte GT 0 then begin
  22 + EBounds = fltarr(EnNum+1)
  23 + EBounds(min(eindex)) = Energy(min(eindex))
  24 + EBounds(max(eindex+1)) = Energy(max(eindex))
  25 + for ie = min(eindex+1), max(eindex) do EBounds(ie) = sqrt(Energy(ie-1)*Energy(ie))
  26 + endif else return
  27 +
  28 +
  29 + ; FillValue = Graph[GraphN].FillValue[0]
  30 +;--------------------- No DATA - just axes -----------------------
  31 + if (N_Elements(*Graph[GraphN].Time[0]) eq 0) then begin
  32 + nodata
  33 + return
  34 + endif
  35 +
  36 + Time = (*Graph[GraphN].Time[0])
  37 +
  38 + Val = (*Graph[GraphN].Val[0])
  39 + N_Time = N_elements(Time);
  40 +
  41 + if (elevation) then begin
  42 + Val = temporary(reform(Val, 16, 96, 16, N_Time))
  43 + LocVal = azMax GT azMin ? total(total(Val[azMin:azMax,*,0:15, *],1),2) : reform(total(Val[azMin,*,0:15,*],3), 96, N_time);
  44 + newTime = Time;
  45 + deltaT = 96.0;
  46 + gapT = deltaT*10.0 ;
  47 + endif else begin
  48 +; elevation as TIME
  49 + newTime = dblarr(N_Time*16);
  50 + for i = 0, N_Time - 1 do for j = 0, 15 do newTime[i*16 + j] = Time[i] + j*12.D0
  51 + N_Time *= 16;
  52 + Val = temporary(reform(Val, 16, 96, N_Time));
  53 + LocVal = azMax GT azMin ? total(Val[azMin:azMax,*,*],1) : reform(Val[azMin,*,*], 96, N_time);
  54 + deltaT = 6.0;
  55 + gapT = deltaT*10.0;
  56 + endelse
  57 +
  58 + num0 = where(EBounds ge enMin, Index0);
  59 + num1 = where(EBounds ge enMax, Index1);
  60 +
  61 + if (Index1 eq 0) then numStop = 0 else numStop = num1[Index1-1];
  62 + if (Index0 eq EnNum+1) then numStart = 95 else numStart = num0[Index0-1];
  63 +
  64 + Data = numStart ne numStop ? total(LocVal[numStop:numStart,*],1) : reform(LocVal[numStart,*], N_Time);
  65 + numMinMax = where(finite(Data), IndexMinMax)
  66 + MinVal = min(Data[numMinMax]) > 0.1;
  67 + MaxVal = max(Data[numMinMax]);
  68 +
  69 +
  70 + if Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] then begin
  71 + Graph[GraphN].Ly.range = Graph[GraphN].AxisF eq 'logaxis' ? [MinVal, MaxVal] : [0.0, MaxVal]
  72 + Graph[GraphN].Ly.style = 0
  73 + endif else Graph[GraphN].Ly.style = 1
  74 +
  75 + !y = Graph[GraphN].Ly;
  76 +
  77 + if (execute(Graph[GraphN].AxisF) NE 1) then plot, newTime, Data, MAX_VALUE=MaxValue, color = !dnc-1, /NODATA, /NOERASE
  78 +
  79 + plots, newTime[0]+deltaT, Data[0], /DATA
  80 +
  81 + for i = 1, N_elements(newTime) - 1 do begin
  82 + if (newTime[i] LE Graph[GraphN].TotalTime) then begin
  83 + if (data[i] lt Graph[GraphN].Ly.range[0]) then data[i] = Graph[GraphN].Ly.range[0];
  84 + if (data[i] gt Graph[GraphN].Ly.range[1]) then data[i] = Graph[GraphN].Ly.range[1];
  85 + if (newTime[i] - newTime[i-1] LE gapT) then $
  86 + plots, newTime[i]+deltaT, data[i], color=col, /CONTINUE, /DATA $
  87 + else plots, newTime[i]+deltaT, data[i], /DATA
  88 + endif
  89 + endfor
  90 +
  91 +return
  92 +end
  93 +;--------------------------------------------------------------------
... ...
amda_plus/amdalib/imaspecplot.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/imaspecplot.pro
... ... @@ -0,0 +1,172 @@
  1 +;============================================================
  2 +;
  3 +;=============================================================
  4 +
  5 +pro imaspecplot, Mission, AzMin, AzMax, elevation
  6 +
  7 + common GraphC, Graph, GraphN, Item
  8 + common Etab, FlagVex, EtabVex, FlagMex, EtabMex
  9 +
  10 + ;------- Energy table -----------------
  11 + if (Mission eq 'vex') then begin
  12 + numTab = where(finite(*EtabVex[0].val) eq 0, indexTab);
  13 + if (indexTab GT 0) then (*EtabVex[0].val)[numTab] = -1;
  14 + Tab = fix(*EtabVex[0].val);
  15 + endif else begin
  16 + numTab = where(finite(*EtabMex[0].val) eq 0, indexTab);
  17 + if (indexTab GT 0) then (*EtabMex[0].val)[numTab] = -1;
  18 + Tab = fix(*EtabMex[0].val);
  19 + endelse
  20 +
  21 + EnNum0 = 96
  22 + Energy = fltarr(EnNum0);
  23 + Energy1 = fltarr(EnNum0);
  24 +
  25 + numTab = uniq(Tab,sort(Tab));
  26 + uniqTab = Tab[numTab];
  27 +; set min/max energy
  28 + EnergyMin = 10000.0;
  29 + EnergyMax = 0.0;
  30 + for i = 0, N_elements(uniqTab) - 1 do begin
  31 + if uniqTab[i] lt 0 then continue;
  32 + RetSize = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy1, uniqTab[i]);
  33 + Energy1 = temporary(Energy1(where(Energy1 GT 0)));
  34 + if (min(Energy1) LT EnergyMin) then EnergyMin = min(Energy1);
  35 + if (max(Energy1) GT EnergyMax) then EnergyMax = max(Energy1);
  36 + endfor
  37 +
  38 + RetSize = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy, Tab[0])
  39 +
  40 + Energy = temporary(Energy(where(Energy GT 0)));
  41 + EnNum = N_elements(Energy)
  42 +
  43 + ;-------- Cat in the Energy range ------------
  44 + E0 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? min(Energy) : Graph[GraphN].Ly.range[0]
  45 + E1 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? max(Energy) : Graph[GraphN].Ly.range[1]
  46 +
  47 + eindex = where((Energy GE E0) AND $
  48 + (Energy LE E1) AND $
  49 + (Energy GT 0.0),counte)
  50 +
  51 + if counte GT 0 then begin
  52 + EBounds = fltarr(EnNum+1)
  53 + EBounds(min(eindex)) = Energy(min(eindex))
  54 + EBounds(max(eindex+1)) = Energy(max(eindex))
  55 + for ie = min(eindex+1), max(eindex) do EBounds[ie] = sqrt(Energy[ie-1]*Energy[ie])
  56 + endif else begin
  57 + nodata
  58 + return
  59 + endelse
  60 +
  61 +;--------------------- No DATA - just axes -----------------------
  62 + if (N_Elements(*Graph[GraphN].Time[0]) eq 0) then begin
  63 + nodata
  64 + return
  65 + endif
  66 +
  67 + Time = (*Graph[GraphN].Time[0])
  68 +
  69 + Val = (*Graph[GraphN].Val[0])
  70 + N_Time = N_elements(Time);
  71 +
  72 + if (elevation) then begin
  73 + Val = temporary(reform(Val, 16, 96, 16, N_Time))
  74 + LocVal = azMax GT azMin ? total(total(Val[azMin:azMax,*,0:15, *],1),2) : reform(total(Val[azMin,*,0:15,*],3), 96, N_time);
  75 + newTime = Time;
  76 + endif else begin
  77 +; elevation as TIME
  78 + newTime = dblarr(N_Time*16);
  79 + for i = 0, N_Time - 1 do for j = 0, 15 do newTime[i*16 + j] = Time[i] + j*12.D0
  80 + N_Time *= 16;
  81 + Val = temporary(reform(Val,16, 96, N_Time));
  82 + LocVal = azMax GT azMin ? total(Val[azMin:azMax,*,*],1) : reform(Val[azMin,*,*], 96, N_time);
  83 + endelse
  84 +
  85 + numMinMax = where(LocVal gt 0.5, IndexMinMax)
  86 +
  87 + if (Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1]) then $
  88 + Graph[GraphN].Ly.range = [EnergyMin, EnergyMax]
  89 +
  90 + Graph[GraphN].Ly.style = 1
  91 +
  92 + !y = Graph[GraphN].Ly
  93 +
  94 + plot_io, graph[GraphN].Lx.range, graph[GraphN].Ly.range, /nodata, /noerase, ystyle = 1, $
  95 + ytickformat='yticks', charsize=graph[GraphN].Lp.charsize*0.8, color = !dnc-1
  96 +
  97 + Step = Graph[GraphN].Sampling[0] > Graph[GraphN].Step;
  98 + if (not elevation) then Step /= 16.0;
  99 +
  100 + ;--------------------- No DATA - just axes -----------------------
  101 + if (IndexMinMax LE 0) then begin
  102 + nodatafortimeinterval
  103 + return
  104 + endif
  105 + if (Time[0] GT Graph[GraphN].TotalTime) then begin
  106 + nodatafortimeinterval
  107 + return
  108 + endif
  109 +
  110 +
  111 + MinVal = min(LocVal[numMinMax]) > 0.5
  112 + MaxVal = max(LocVal[numMinMax])
  113 +
  114 + ;----------- NOW PLOT SPECTRA
  115 + alogMin = alog(MinVal)
  116 + KF = float(!DNC - 2) /(alog(MaxVal) - alogMin)
  117 + xx = fltarr(4) & yy = fltarr(4)
  118 +
  119 + for i = 0, N_Time - 2 do begin
  120 +
  121 + ii = elevation ? i : i/16 < (N_elements(Tab) - 2);
  122 +
  123 + if (Tab[ii+1] ne Tab[ii] AND Tab[ii+1] GE 0) then begin
  124 + Energy = fltarr(EnNum0)
  125 + RetSize = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy, Tab[ii+1])
  126 + Energy = temporary(Energy(where(Energy GT 0)));
  127 + EnNum = N_elements(Energy)
  128 +
  129 + ;-------- Cat in the Energy range ------------
  130 + E0 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? min(Energy) : Graph[GraphN].Ly.range[0]
  131 + E1 = Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1] ? max(Energy) : Graph[GraphN].Ly.range[1]
  132 + eindex = where((Energy GE E0) AND $
  133 + (Energy LE E1) AND $
  134 + (Energy GT 0.0),counte)
  135 + if counte GT 0 then begin
  136 + EBounds = fltarr(EnNum+1)
  137 + EBounds(min(eindex)) = Energy(min(eindex))
  138 + EBounds(max(eindex+1)) = Energy(max(eindex))
  139 + for ie = min(eindex+1), max(eindex) do EBounds(ie) = sqrt(Energy(ie-1)*Energy(ie))
  140 + endif else return
  141 + endif
  142 + xx[0] = newTime[i] > 0.0
  143 + xx[1] = xx[0]
  144 + xx[2] = newTime[i+1] < newTime[i] + Step
  145 + xx[3] = xx[2]
  146 +
  147 + if (xx[2] LE graph[GraphN].TotalTime AND xx[0] LT graph[GraphN].TotalTime) then begin
  148 + for k = min(eindex), max(eindex) do begin
  149 + yy[0] = EBounds[k]
  150 + yy[1] = EBounds[k+1]
  151 + yy[2] = yy[1]
  152 + yy[3] = yy[0]
  153 + lcount = LocVal[k,i] < 1.e5
  154 + if finite(lcount) then begin
  155 + cl = lcount GT MinVal ? fix(KF*(alog(lcount) - alogMin)) : 1;
  156 + endif else cl = 0;
  157 +
  158 + if (cl GT !DNC - 2) then cl = !DNC - 2
  159 + PolyFill, xx ,yy, color = cl, /data
  160 + endfor
  161 + endif
  162 + endfor
  163 +
  164 +;-------------------- Legend ----------------------------------------
  165 + spec_legend, MinVal, MaxVal
  166 +;------------------ MIN-MAX------------------------------------------------
  167 + Graph[GraphN].Min = MinVal
  168 + Graph[GraphN].Max = MaxVal
  169 +
  170 +return
  171 +end
  172 +;--------------------------------------------------------------------
... ...
amda_plus/amdalib/legend_multi.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/legend_multi.pro
... ... @@ -0,0 +1,11 @@
  1 +pro legend_multi, Names, Colors
  2 +common GraphC, Graph, GraphN, Item
  3 +
  4 + xy = Graph[GraphN].lp.region
  5 + y0 = xy[1] + (xy[3] - xy[1])/2. + 0.02*(N_elements(Names)-1)/2
  6 +
  7 + for i = 0, N_elements(Names)-1 do $
  8 + xyouts, xy[2]+0.02, y0-0.03*i ,Names[i], /NORMAL, charsize=graph[GraphN].Lp.charsize*0.8, color=Colors[i]
  9 +
  10 +return
  11 +end
0 12 \ No newline at end of file
... ...
amda_plus/amdalib/lep_g_0_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_0_init.pro
... ... @@ -0,0 +1,24 @@
  1 +;-----------------GTLN_INIT--------------------------
  2 +;
  3 +pro lep_g_0_INIT, LIN = LIN, LOG = LOG, RED = RED, BLUE = BLUE, GREEN = GREEN
  4 +
  5 +common GraphC, graph, GraphN, Item
  6 +
  7 + pen = 0
  8 +
  9 + if KEYWORD_SET(RED) then pen = 3
  10 + if KEYWORD_SET(BLUE) then pen = 1
  11 + if KEYWORD_SET(GREEN) then pen = 2
  12 +
  13 +graph[GraphN].Type = 'HIAM_T'
  14 +graph[GraphN].DataN = 1
  15 +graph[GraphN].SetCommonF[0] = 'gtlcom'
  16 +graph[GraphN].GetDataF[0] ='getgtl'
  17 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime+30.0D0) < 18000.0D0
  18 +graph[GraphN].Ly.title = 'GTL !C N, cm!U-3'
  19 +graph[GraphN].AxisF = KEYWORD_SET(LIN) ? 'lineaxis,0' : 'logaxis'
  20 +graph[GraphN].PlotF = 'plotscal, 3,'+ string(pen)
  21 +graph[GraphN].LastPlotF = 'nodatalast'
  22 +return
  23 +end
  24 +;------------------------------------------------------------
... ...
amda_plus/amdalib/lep_g_1_3_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_1_3_init.pro
... ... @@ -0,0 +1,42 @@
  1 +;-----------------GTLV_INIT--------------------------
  2 +; ---------------------------------------------------------
  3 +pro lep_g_1_3_INIT, X = X, Y = Y, Z = Z, TOT = TOT, GSE = GSE, GSM = GSM, SM = SM, RED = RED, GREEN = GREEN, BLUE = BLUE
  4 +
  5 +common GraphC, graph, GraphN, Item
  6 +
  7 + names = ['V!DX', 'V!DY', 'V!DZ', 'V']
  8 + comp = 4 & pen = 0
  9 +
  10 + if KEYWORD_SET(X) then comp = 0
  11 + if KEYWORD_SET(Y) then comp = 1
  12 + if KEYWORD_SET(Z) then comp = 2
  13 + if KEYWORD_SET(TOT) then comp = 3
  14 + if KEYWORD_SET(BLUE) then pen = 1
  15 + if KEYWORD_SET(GREEN) then pen = 2
  16 + if KEYWORD_SET(RED) then pen = 3
  17 +
  18 +frame = 'GSE'
  19 +
  20 +if KEYWORD_SET(GSM) then begin
  21 + frame = 'GSM'
  22 + graph[GraphN].ProcessF='gse2gsm'
  23 +endif
  24 +if KEYWORD_SET(SM) then begin
  25 + frame = 'SM'
  26 + graph[GraphN].ProcessF='gse2sm'
  27 +endif
  28 +
  29 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  30 +graph[GraphN].Type = 'HIAM_T'
  31 +graph[GraphN].DataN = 1
  32 +graph[GraphN].SetCommonF[0] = 'gtlcom'
  33 +graph[GraphN].GetDataF[0] ='getgtl'
  34 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime+30.0D0) < 18000.0D0
  35 +graph[GraphN].Ly.title = 'GTL !CV '+frame+', km/s'
  36 +graph[GraphN].AxisF = 'lineaxis,' + string(Graph[GraphN].TotalTime)
  37 +*(graph[GraphN].names) = (comp le 3) ? names : names[0:2]
  38 +graph[GraphN].PlotF = (comp le 3) ? 'plotvec_comp_, '+string(comp)+',' +string(pen) : 'plotvec_'
  39 +graph[GraphN].LastPlotF = 'nodatalast'
  40 +return
  41 +end
  42 +;------------------------------------------------------------
... ...
amda_plus/amdalib/lep_g_1_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_1_init.pro
... ... @@ -0,0 +1,17 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro lep_g_1_init, GSE = GSE, GSM = GSM, SM = SM, RED = RED, GREEN = GREEN, BLUE = BLUE
  4 +
  5 + cmd = 'lep_g_1_3_init, /X'
  6 + if KEYWORD_SET(GSM) then cmd += ',/GSM'
  7 + if KEYWORD_SET(SM) then cmd += ',/SM'
  8 +
  9 + if KEYWORD_SET(BLUE) then cmd += ',/BLUE'
  10 + if KEYWORD_SET(RED) then cmd += ',/RED'
  11 + if KEYWORD_SET(GREEN) then cmd += ',/GREEN'
  12 +
  13 + R = execute(cmd)
  14 +
  15 +return
  16 +end
  17 +;------------------------------------------------------------
0 18 \ No newline at end of file
... ...
amda_plus/amdalib/lep_g_2_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_2_init.pro
... ... @@ -0,0 +1,17 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro lep_g_2_init, GSE = GSE, GSM = GSM, SM = SM, RED = RED, GREEN = GREEN, BLUE = BLUE
  4 +
  5 + cmd = 'lep_g_1_3_init, /Y'
  6 + if KEYWORD_SET(GSM) then cmd += ',/GSM'
  7 + if KEYWORD_SET(SM) then cmd += ',/SM'
  8 +
  9 + if KEYWORD_SET(BLUE) then cmd += ',/BLUE'
  10 + if KEYWORD_SET(RED) then cmd += ',/RED'
  11 + if KEYWORD_SET(GREEN) then cmd += ',/GREEN'
  12 +
  13 + R = execute(cmd)
  14 +
  15 +return
  16 +end
  17 +;------------------------------------------------------------
0 18 \ No newline at end of file
... ...
amda_plus/amdalib/lep_g_3_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_3_init.pro
... ... @@ -0,0 +1,17 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro lep_g_3_init, GSE = GSE, GSM = GSM, SM = SM, RED = RED, GREEN = GREEN, BLUE = BLUE
  4 +
  5 + cmd = 'lep_g_1_3_init, /Z'
  6 + if KEYWORD_SET(GSM) then cmd += ',/GSM'
  7 + if KEYWORD_SET(SM) then cmd += ',/SM'
  8 +
  9 + if KEYWORD_SET(BLUE) then cmd += ',/BLUE'
  10 + if KEYWORD_SET(RED) then cmd += ',/RED'
  11 + if KEYWORD_SET(GREEN) then cmd += ',/GREEN'
  12 +
  13 + R = execute(cmd)
  14 +
  15 +return
  16 +end
  17 +;------------------------------------------------------------
0 18 \ No newline at end of file
... ...
amda_plus/amdalib/lep_g_4_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_4_init.pro
... ... @@ -0,0 +1,15 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro lep_g_4_init, GSE = GSE, GSM = GSM, SM = SM, RED = RED, GREEN = GREEN, BLUE = BLUE
  4 +
  5 + cmd = 'lep_g_1_3_init, /TOT'
  6 +
  7 + if KEYWORD_SET(BLUE) then cmd += ',/BLUE'
  8 + if KEYWORD_SET(RED) then cmd += ',/RED'
  9 + if KEYWORD_SET(GREEN) then cmd += ',/GREEN'
  10 +
  11 + R = execute(cmd)
  12 +
  13 +return
  14 +end
  15 +;------------------------------------------------------------
0 16 \ No newline at end of file
... ...
amda_plus/amdalib/lep_g_5_6_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_5_6_init.pro
... ... @@ -0,0 +1,29 @@
  1 +;-----------------GTLT_INIT--------------------------
  2 +; 14 Apr, 2004 V2.5
  3 +;-------------------------------------------------------
  4 +pro lep_g_5_6_INIT, PAR=PAR, PERP=PERP, RED = RED, GREEN = GREEN, BLUE = BLUE, LIN = LIN, LOG = LOG
  5 +
  6 +common GraphC, graph, GraphN, Item
  7 +names = ['T!DYY', 'T!DZZ']
  8 +comp = 2 & pen = 0
  9 +
  10 + if KEYWORD_SET(BLUE) then pen = 1
  11 + if KEYWORD_SET(GREEN) then pen = 2
  12 + if KEYWORD_SET(RED) then pen = 3
  13 + if KEYWORD_SET(PAR) then comp = 0
  14 + if KEYWORD_SET(PERP) then comp = 1
  15 +
  16 +graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  17 +graph[GraphN].Type = 'HIAM_T'
  18 +graph[GraphN].DataN = 1
  19 +graph[GraphN].SetCommonF[0] = 'gtlcom'
  20 +graph[GraphN].GetDataF[0] = 'getgtl'
  21 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime+30.0D0) < 18000.0D0
  22 +graph[GraphN].Ly.title = 'GTL !C T, eV'
  23 +graph[GraphN].AxisF = 'logaxis'
  24 +*(graph[GraphN].names) = names
  25 +graph[GraphN].PlotF = (comp le 1) ? 'plotten_comp, 4, 2,'+string(comp)+',' +string(pen) : 'plotten, 4, 2'
  26 +graph(GraphN).LastPlotF = 'nodatalast'
  27 +return
  28 +end
  29 +;------------------------------------------------------------
... ...
amda_plus/amdalib/lep_g_5_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_5_init.pro
... ... @@ -0,0 +1,15 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro lep_g_5_init, RED = RED, GREEN = GREEN, BLUE = BLUE, LIN = LIN, LOG = LOG
  4 +
  5 + cmd = 'lep_g_5_6_init, /PAR'
  6 +
  7 + if KEYWORD_SET(BLUE) then cmd += ',/BLUE'
  8 + if KEYWORD_SET(RED) then cmd += ',/RED'
  9 + if KEYWORD_SET(GREEN) then cmd += ',/GREEN'
  10 +
  11 + R = execute(cmd)
  12 +
  13 +return
  14 +end
  15 +;------------------------------------------------------------
0 16 \ No newline at end of file
... ...
amda_plus/amdalib/lep_g_6_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/lep_g_6_init.pro
... ... @@ -0,0 +1,15 @@
  1 +;----------------ENVELOPE-------------------------
  2 +;
  3 +pro lep_g_6_init, RED = RED, GREEN = GREEN, BLUE = BLUE, LIN = LIN, LOG = LOG
  4 +
  5 + cmd = 'lep_g_5_6_init, /PERP'
  6 +
  7 + if KEYWORD_SET(BLUE) then cmd += ',/BLUE'
  8 + if KEYWORD_SET(RED) then cmd += ',/RED'
  9 + if KEYWORD_SET(GREEN) then cmd += ',/GREEN'
  10 +
  11 + R = execute(cmd)
  12 +
  13 +return
  14 +end
  15 +;------------------------------------------------------------
0 16 \ No newline at end of file
... ...
amda_plus/amdalib/median_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/median_.pro
... ... @@ -0,0 +1,18 @@
  1 +function median_, Data, T_AVER
  2 +
  3 +common InternalCommon, FinalTime, num
  4 +
  5 + Npoints = N_elements(FinalTime);
  6 + Nreal = n_elements(num);
  7 + Timy = FinalTime(num);
  8 +
  9 + FillValue = !Values.F_NAN
  10 + outPut = replicate(FillValue, Nreal); outPut = fltarr(Nreal);
  11 +
  12 + for tt = FinalTime[0], FinalTime[Npoints-1]+T_AVER, T_AVER do begin
  13 + nummi = where(abs(tt - Timy) LE T_AVER/2.0, Index)
  14 + if (Index GT 0) then OutPut[nummi] = median(Data[nummi])
  15 + endfor
  16 +
  17 +return, OutPut
  18 +end
0 19 \ No newline at end of file
... ...
amda_plus/amdalib/mercorbaxis.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mercorbaxis.pro
... ... @@ -0,0 +1,110 @@
  1 +;==================================================
  2 +; DD MERCURY
  3 +; ORBITAL OBJECTS
  4 +; mercorbaxis.pro
  5 +;
  6 +;---------------------------------------------------
  7 +; Implementation of all types of axis for orbital plot
  8 +; Options:
  9 +; Key ToPlot
  10 +; /CYL - cylindrical XR 0
  11 +; /XY 1
  12 +; /XZ 2
  13 +; /YZ 3
  14 +;====================================================
  15 +
  16 +pro mercorbaxis, ToPlot
  17 +common GraphC, graph, GraphN
  18 +
  19 +;------------ Set graphics Colors ------------------------
  20 + if (Graph[GraphN].Lx.range[0] eq Graph[GraphN].Lx.range[1]) then begin
  21 + Graph[GraphN].Lx.range[0] = -5;
  22 + Graph[GraphN].Lx.range[1] = 5;
  23 + endif
  24 + if (Graph[GraphN].Ly.range[0] eq Graph[GraphN].Ly.range[1]) then begin
  25 + Graph[GraphN].Ly.range[0] = ToPlot eq 0 ? 0: -5;
  26 + Graph[GraphN].Ly.range[1] = 5;
  27 + endif
  28 +
  29 + !x = Graph[GraphN].Lx
  30 + !y = Graph[GraphN].Ly
  31 +
  32 + x = !x.range
  33 + y = !y.range
  34 + black = !DNC- 1
  35 + zero = fix(!DNC * 20.0/ 256.0 )
  36 + planet = fix(!DNC * 10.0/ 256.0)
  37 + bound = fix(!DNC * 1.0/ 256.0)
  38 +;------------------------------------------------------------
  39 +
  40 + ThickPlanet = 2
  41 + ThickBound = 2
  42 +
  43 +;------- main axis -----------------
  44 + case ToPlot of
  45 + 0: begin
  46 + !x.title = 'X, R!DM'
  47 + !y.title = 'R, R!DM'
  48 + end
  49 + 1: begin
  50 + !x.title = 'X, R!DM'
  51 + !y.title = 'Y, R!DM'
  52 + end
  53 + 2: begin
  54 + !x.title = 'X, R!DM'
  55 + !y.title = 'Z, R!DM'
  56 + end
  57 + 3: begin
  58 + !x.title = 'Y, R!DM'
  59 + !y.title = 'Z, R!DM'
  60 + end
  61 + endcase
  62 +
  63 + ;------ Plot main axis. Use common Graph system variables
  64 + plot,x,y,/nodata,/noerase,xstyle=1,ystyle=1,color=black,xminor=1, yminor=1, charsize=graph[GraphN].Lp.charsize
  65 +
  66 + ;------- plot Zero lines ---------------------
  67 + oplot,x,[0,0],color=zero, thick = 1
  68 + oplot,[0,0],y,color=zero, thick = 1
  69 +
  70 + ;------- plot Mars ---------------------
  71 + dal = 2.0 * !PI / 60.
  72 + if ToPlot EQ 0 then $
  73 + al = dal * findgen(31) $
  74 + else al = dal * findgen(61)
  75 +
  76 + xx = cos(al)
  77 + yy = sin(al)
  78 + oplot,xx,yy,color=black, thick = ThickPlanet
  79 +
  80 + if ToPlot EQ 0 then begin
  81 + ;---- Plot boundaries for cylindrical plot
  82 + ;----------------------- Bow Shock -----------------------------
  83 + theta = (135.*!pi/180.)*findgen(100)/100.
  84 +
  85 + rr = 2.96/(1.0+1.02*cos(theta))
  86 + xx = fltarr(100)
  87 + yy = fltarr(100)
  88 +
  89 + for i = 0, 99 do begin
  90 + xx(i) = 0.5 + rr(i)*cos(theta(i))
  91 + yy(i) = rr(i)*sin(theta(i))
  92 + endfor
  93 +
  94 + oplot,xx,yy,color=bound, thick = ThickBound
  95 + oplot,xx,-yy,color=bound, thick = ThickBound
  96 +
  97 + ;----------------------- MP Shue-----------------------------
  98 + alpha = 0.5;
  99 + r0 = 1.45;
  100 +
  101 + rr=r0*(2./(1.+COS(theta)))^alpha
  102 +
  103 + xx = rr*cos(theta)
  104 + yy = rr*sin(theta)
  105 +
  106 + oplot,xx,rr,color=bound, thick = ThickBound
  107 + oplot,xx,-rr,color=bound, thick = ThickBound
  108 + endif
  109 +return
  110 +end
... ...
amda_plus/amdalib/mex_els_spec_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_els_spec_init.pro
... ... @@ -0,0 +1,61 @@
  1 +;==========================================================
  2 +; DD DDMARS/DDVEX
  3 +; elspec_init.pro
  4 +;-----------------------------------------------------------
  5 +
  6 +pro mex_els_spec_init, ANODE = Anode, Stop_Anode = Stop_Anode, $
  7 + LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  8 + ; spectra
  9 + MINCOUNT = minCount, MAXCOUNT = maxCount, BACKGRDCHAN = backgrdChan, BACKGRDVAL = backgrdVal, $
  10 + CHANNEL = channel, Energy = energy, ENERGYMIN = energymin, ENERGYMAX = energymax, $
  11 +
  12 + DELAY = delay, $
  13 + ; all additional keywords
  14 + _EXTRA = e
  15 +
  16 +common Request, List, StartTime, TimeInt
  17 +common GraphC, graph, GraphN, Item
  18 +
  19 +AnMin = 0
  20 +AnMax = 15
  21 +
  22 +EnMin = 1.0;
  23 +EnMax = 2800.0;
  24 +
  25 +if (KEYWORD_SET(ANODE)) then begin
  26 + AnMin = Anode
  27 + if (KEYWORD_SET(Stop_Anode)) then AnMax = Stop_Anode $
  28 + else AnMax = -1;
  29 +endif
  30 +
  31 +graph[GraphN].Type = 'ELS_T'
  32 +graph[GraphN].DataN = 1
  33 +graph[GraphN].SetCommonF[0] = 'elscom, "mex"'
  34 +graph[GraphN].GetDataF[0] = 'getels, "mex"'
  35 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 36100.0D0
  36 +energyTitle = '';
  37 +
  38 +if (KEYWORD_SET(energymin)) then begin
  39 + EnMin = energymin;
  40 + EnMax = energymax;
  41 + energyTitle = energymin eq energymax ? '!C E ' + string(energymin) + 'eV' : '!C E ' + string(energymin) + '-'+ string(energymax) + 'eV';
  42 +
  43 + options = '"mex", ' + string(AnMin) +','+string(AnMax) +',' +string(EnMin) +','+string(EnMax);
  44 + angleTitle = AnMax GT AnMin ? 'MEX ELS An'+ string(AnMin,format='(i2.2)') +'-'+ string(AnMax,format='(i2.2)') : 'MEX ELS An'+ string(AnMin,format='(i2.2)');
  45 +
  46 + graph[GraphN].AxisF = KEYWORD_SET(lin) ? 'lineaxis, 0' : 'logaxis';
  47 + graph[GraphN].Ly.title = 'MEX ELS Cnts ' + angleTitle + energyTitle
  48 + graph[GraphN].PlotF = 'elscntplot,' + options
  49 +endif else begin
  50 + options = '"mex", ' + string(AnMin) +','+string(AnMax);
  51 +
  52 + graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  53 + *(graph[GraphN].names) = 'log Counts'
  54 +
  55 + graph[GraphN].Ly.title = AnMax GT AnMin ? 'MEX ELS An'+ string(AnMin,format='(i2.2)') +'-'+ string(AnMax,format='(i2.2)') +'!C E, eV' : 'MEX ELS An'+ string(AnMin,format='(i2.2)') + '!C E, eV'
  56 + graph[GraphN].PlotF = 'elsspecplot,' + options
  57 +
  58 +endelse
  59 +return
  60 +end
  61 +;------------------------------------------------------------
... ...
amda_plus/amdalib/mex_h_dens_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_dens_.pro
... ... @@ -0,0 +1,54 @@
  1 +function MEX_H_DENS_, StartTime, TimeInt, Time, RetSize, Sampling, close=close
  2 +common GraphC, graph, GraphN
  3 +common MEXHDENS_COM, ID
  4 +
  5 + FillValue = !Values.F_NAN
  6 + if n_elements(ID) EQ 0 then ID = -1L
  7 + sampling = 192.0
  8 + Size = long(graph[GraphN].DeltaT/sampling)
  9 +
  10 + Bdata = fltarr(Size)
  11 + Time = dblarr(Size)
  12 + Quality = fltarr(Size)
  13 + Time_Q = dblarr(Size)
  14 +
  15 + Mission ="mex";
  16 +
  17 + VI = Mission + ':ima:param'
  18 + ParamName = "Density_P";
  19 +
  20 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  21 + ID, VI, ParamName, StartTime, TimeInt, Size, Time, Bdata)
  22 +
  23 + ParamName = "Quality_P";
  24 +
  25 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  26 + ID, VI, ParamName, StartTime, TimeInt, Size, Time_Q, Quality)
  27 +
  28 + if KEYWORD_SET(CLOSE) then begin
  29 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  30 + ID = -1L
  31 + endif
  32 +
  33 + if (RetSize LE 0) then begin
  34 + Time = 0.D0
  35 + return, 0.0
  36 + endif
  37 +
  38 + Time=Time[0:Retsize-1]
  39 + Bdata=Bdata[0:Retsize-1]
  40 + Quality = Quality[0:Retsize-1]
  41 + ; num_gap = where(Quality GE 0.7, Cntr)
  42 +
  43 + ; if Cntr le 0 then begin
  44 + ; Retsize = -999
  45 + ; Time = 0.D0
  46 + ; return, 0.0
  47 + ; endif
  48 +
  49 + ; Time=Time[num_gap]
  50 + ; Bdata=Bdata[num_gap];
  51 + ; Retsize=Cntr
  52 +
  53 +return, Bdata
  54 +end
0 55 \ No newline at end of file
... ...
amda_plus/amdalib/mex_h_dens_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_dens_init.pro
... ... @@ -0,0 +1,24 @@
  1 +;--------------------------------------
  2 +;
  3 +;---------------------------------------
  4 +
  5 +pro mex_h_dens_INIT, LIN = LIN, LOG = LOG, COLOR = color, PSYM = psym
  6 +
  7 +common GraphC, graph, GraphN, Item
  8 +
  9 +names = ['Poor', 'Satisfactory', 'Good', 'Excellent']
  10 +
  11 +Graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  12 +*(graph[GraphN].names) = names;
  13 +graph[GraphN].Type = 'FGM_T'
  14 +graph[GraphN].DataN = 1
  15 +graph[GraphN].SetCommonF[0] = 'vexmex_dens_com, "mex", "h"'
  16 +
  17 +graph[GraphN].GetDataF[0] ='get_vexmex_dens, "mex", "h"'
  18 +
  19 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 36100.0D0
  20 +graph[GraphN].Ly.title = 'MEX ima-H N, cm!U-3'
  21 +graph[GraphN].AxisF = KEYWORD_SET(LIN) ? 'lineaxis, 0' : 'logaxis'
  22 +graph[GraphN].PlotF = 'PlotImaDens'
  23 +return
  24 +end
... ...
amda_plus/amdalib/mex_h_dens_restr_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_dens_restr_.pro
... ... @@ -0,0 +1,52 @@
  1 +function MEX_H_DENS_RESTR_, StartTime, TimeInt, Time, RetSize, Sampling, close=close
  2 +common GraphC, graph, GraphN
  3 +common MEXHDENS_COM, ID
  4 +
  5 + FillValue = !Values.F_NAN
  6 + if n_elements(ID) EQ 0 then ID = -1L
  7 + sampling = 192.0
  8 + Size = long(graph[GraphN].DeltaT/sampling)
  9 +
  10 + Bdata = fltarr(Size)
  11 + Time = dblarr(Size)
  12 + Quality = fltarr(Size)
  13 + Time_Q = dblarr(Size)
  14 +
  15 + VI = 'mex:imaparam:restricted'
  16 + ParamName = "Density_P";
  17 +
  18 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  19 + ID, VI, ParamName, StartTime, TimeInt, Size, Time, Bdata)
  20 +
  21 + ParamName = "Quality_P";
  22 +
  23 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  24 + ID, VI, ParamName, StartTime, TimeInt, Size, Time_Q, Quality)
  25 +
  26 + if KEYWORD_SET(CLOSE) then begin
  27 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  28 + ID = -1L
  29 + endif
  30 +
  31 + if (RetSize LE 0) then begin
  32 + Time = 0.D0
  33 + return, 0.0
  34 + endif
  35 +
  36 + Time=Time[0:Retsize-1]
  37 + Bdata=Bdata[0:Retsize-1]
  38 + Quality = Quality[0:Retsize-1]
  39 + ; num_gap = where(Quality GE 0.7, Cntr)
  40 +
  41 + ; if Cntr le 0 then begin
  42 + ; Retsize = -999
  43 + ; Time = 0.D0
  44 + ; return, 0.0
  45 + ; endif
  46 +
  47 + ; Time=Time[num_gap]
  48 + ; Bdata=Bdata[num_gap];
  49 + ; Retsize=Cntr
  50 +
  51 +return, Bdata
  52 +end
0 53 \ No newline at end of file
... ...
amda_plus/amdalib/mex_h_dens_restr_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_dens_restr_init.pro
... ... @@ -0,0 +1,24 @@
  1 +;--------------------------------------
  2 +;
  3 +;---------------------------------------
  4 +
  5 +pro mex_h_dens_restr_INIT, LIN = LIN, LOG = LOG, COLOR = color, PSYM = psym
  6 +
  7 +common GraphC, graph, GraphN, Item
  8 +
  9 +names = ['Poor', 'Satisfactory', 'Good', 'Excellent']
  10 +
  11 +Graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  12 +*(graph[GraphN].names) = names;
  13 +graph[GraphN].Type = 'FGM_T'
  14 +graph[GraphN].DataN = 1
  15 +graph[GraphN].SetCommonF[0] = 'vexmex_dens_com, "mex", "h"'
  16 +
  17 +graph[GraphN].GetDataF[0] = 'get_vexmex_dens, "mex", "h", /RESTRICTED'
  18 +
  19 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 36100.0D0
  20 +graph[GraphN].Ly.title = 'MEX ima-H N, cm!U-3'
  21 +graph[GraphN].AxisF = KEYWORD_SET(LIN) ? 'lineaxis, 0' : 'logaxis'
  22 +graph[GraphN].PlotF = 'PlotImaDens'
  23 +return
  24 +end
... ...
amda_plus/amdalib/mex_h_qual_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_qual_.pro
... ... @@ -0,0 +1,49 @@
  1 +function MEX_H_QUAL_, StartTime, TimeInt, Time, RetSize, Sampling, close=close
  2 +common GraphC, graph, GraphN
  3 +common MEXHQUAL_COM, ID
  4 +
  5 + FillValue = !Values.F_NAN
  6 + if n_elements(ID) EQ 0 then ID = -1L
  7 + sampling = 192.0
  8 + Size = long(graph[GraphN].DeltaT/sampling)
  9 +
  10 + Bdata=fltarr(Size)
  11 + Time=dblarr(Size)
  12 +
  13 + Mission ="mex";
  14 +
  15 + VI = Mission + ':ima:param'
  16 + ParamName = "Quality_P";
  17 +
  18 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  19 + ID, VI, ParamName, StartTime, TimeInt, Size, Time, Bdata)
  20 +
  21 + if KEYWORD_SET(CLOSE) then begin
  22 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  23 + ID = -1L
  24 + endif
  25 +
  26 + if (RetSize LE 0) then begin
  27 + Time = 0.D0
  28 + return, 0.0
  29 + endif
  30 +
  31 + Time=Time[0:Retsize-1]
  32 + Bdata=Bdata[0:Retsize-1]
  33 +
  34 + num_gap = where(finite(Bdata), Cntr)
  35 +
  36 + if Cntr le 0 then begin
  37 + Retsize = -999
  38 + Time = 0.D0
  39 + return, 0.0
  40 + endif
  41 +
  42 + Time=Time[num_gap]
  43 + Bdata=Bdata[num_gap];
  44 + Retsize=Cntr
  45 +
  46 +
  47 +
  48 +return, Bdata
  49 +end
0 50 \ No newline at end of file
... ...
amda_plus/amdalib/mex_h_qual_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_qual_init.pro
... ... @@ -0,0 +1,26 @@
  1 +;--------------------------------------
  2 +;
  3 +;---------------------------------------
  4 +
  5 +pro mex_h_qual_INIT, $
  6 + LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  7 + ; vector
  8 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  9 + DELAY = delay, $
  10 +
  11 + ; all additional keywords
  12 + _EXTRA = e
  13 +
  14 +common GraphC, graph, GraphN, Item
  15 +
  16 +
  17 +graph[GraphN].Type = 'FGM_T'
  18 +graph[GraphN].DataN = 1
  19 +graph[GraphN].SetCommonF[0] = 'vexmex_qual_com, "mex", "h"'
  20 +graph[GraphN].GetDataF[0] ='get_vexmex_qual, "mex", "h"'
  21 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 18000.0D0
  22 +graph[GraphN].Ly.title = 'MEX ima-H Quality'
  23 +graph[GraphN].AxisF = 'lineaxis, 0'
  24 +graph[GraphN].PlotF = 'PlotImaQual'
  25 +return
  26 +end
... ...
amda_plus/amdalib/mex_h_qual_restr_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_qual_restr_.pro
... ... @@ -0,0 +1,47 @@
  1 +function MEX_H_QUAL_RESTR_, StartTime, TimeInt, Time, RetSize, Sampling, close=close
  2 +common GraphC, graph, GraphN
  3 +common MEXHQUAL_COM, ID
  4 +
  5 + FillValue = !Values.F_NAN
  6 + if n_elements(ID) EQ 0 then ID = -1L
  7 + sampling = 192.0
  8 + Size = long(graph[GraphN].DeltaT/sampling)
  9 +
  10 + Bdata=fltarr(Size)
  11 + Time=dblarr(Size)
  12 +
  13 + VI = 'mex:imaparam:restricted'
  14 + ParamName = "Quality_P";
  15 +
  16 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  17 + ID, VI, ParamName, StartTime, TimeInt, Size, Time, Bdata)
  18 +
  19 + if KEYWORD_SET(CLOSE) then begin
  20 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  21 + ID = -1L
  22 + endif
  23 +
  24 + if (RetSize LE 0) then begin
  25 + Time = 0.D0
  26 + return, 0.0
  27 + endif
  28 +
  29 + Time=Time[0:Retsize-1]
  30 + Bdata=Bdata[0:Retsize-1]
  31 +
  32 + num_gap = where(finite(Bdata), Cntr)
  33 +
  34 + if Cntr le 0 then begin
  35 + Retsize = -999
  36 + Time = 0.D0
  37 + return, 0.0
  38 + endif
  39 +
  40 + Time=Time[num_gap]
  41 + Bdata=Bdata[num_gap];
  42 + Retsize=Cntr
  43 +
  44 +
  45 +
  46 +return, Bdata
  47 +end
0 48 \ No newline at end of file
... ...
amda_plus/amdalib/mex_h_qual_restr_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_qual_restr_init.pro
... ... @@ -0,0 +1,26 @@
  1 +;--------------------------------------
  2 +;
  3 +;---------------------------------------
  4 +
  5 +pro mex_h_qual_restr_INIT, $
  6 + LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  7 + ; vector
  8 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  9 + DELAY = delay, $
  10 +
  11 + ; all additional keywords
  12 + _EXTRA = e
  13 +
  14 +common GraphC, graph, GraphN, Item
  15 +
  16 +
  17 +graph[GraphN].Type = 'FGM_T'
  18 +graph[GraphN].DataN = 1
  19 +graph[GraphN].SetCommonF[0] = 'vexmex_qual_com, "mex", "h"'
  20 +graph[GraphN].GetDataF[0] ='get_vexmex_qual, "mex", "h", /RESTRICTED'
  21 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 18000.0D0
  22 +graph[GraphN].Ly.title = 'MEX ima-H Quality'
  23 +graph[GraphN].AxisF = 'lineaxis, 0'
  24 +graph[GraphN].PlotF = 'PlotImaQual'
  25 +return
  26 +end
... ...
amda_plus/amdalib/mex_h_spec_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_spec_.pro
... ... @@ -0,0 +1,63 @@
  1 +function mex_h_spec_, StartTime, TimeInt, Time, RetSize, Sampling, close=close
  2 +common GraphC, graph, GraphN
  3 +common MEX_H_COM, ID, Energy
  4 +
  5 +FORWARD_FUNCTION gfl
  6 +
  7 + FillValue = !Values.F_NAN
  8 +
  9 + if n_elements(ID) EQ 0 then begin
  10 + ID = -1L
  11 + err = call_external(!PROJLIB + 'libplanetcom.so','SetMission_idl', 'mex');
  12 +
  13 + EnNum = 96
  14 + Energy = fltarr(EnNum)
  15 + err = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy, 0)
  16 + Energy = temporary(Energy(where(Energy GT 0)));
  17 + endif
  18 +
  19 + sampling = 192.0;
  20 +
  21 + Size = long(graph[GraphN].DeltaT/sampling)
  22 +
  23 + Time=dblarr(Size)
  24 + SpectraTot = fltarr(16, 96, 16, 2, Size)
  25 + Product = 'HPSPEC';
  26 + PaccArr = intarr(Size);
  27 + EnergyTab = intarr(Size);
  28 +
  29 + RetSize = call_external(!PROJLIB + 'libImaExtra.so','GetImaExtra_idl',$
  30 + ID, StartTime, TimeInt,$
  31 + Product, Size, $
  32 + Time, PaccArr, EnergyTab, SpectraTot)
  33 +
  34 +
  35 + if KEYWORD_SET(CLOSE) then begin
  36 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  37 + ID = -1L
  38 + endif
  39 +
  40 + if (RetSize LE 0) then begin
  41 + Time = 0.D0
  42 + return, replicate(0.0, 96)
  43 + endif
  44 +
  45 + Spectra = fltarr(16, 96, 16, RetSize);
  46 +
  47 + for i = 0, RetSize - 1 do $
  48 + for j = 0, N_elements(Energy) - 1 do begin
  49 + GFeff = gfl(Energy[j], PaccArr[i], 1.0);
  50 + GFeffG = gfl(Energy[j], PaccArr[i], 0.0); Ghost
  51 +
  52 + coeffH = GFeff GT 0 ? 1.e-5/GFeff : 0.0;
  53 + coeffG = GFeffG GT 0 ? 1.e-5/GFeffG : 0.0;
  54 +
  55 + Spectra[*,j,*,i] = SpectraTot[*,j,*,0,i]*coeffH + SpectraTot[*,j,*,1,i] * coeffG;
  56 + endfor
  57 +
  58 +
  59 + SpectraOut = total(total(Spectra,1),2);
  60 + Time=Time[0:Retsize-1]
  61 +
  62 +return, SpectraOut
  63 +end
0 64 \ No newline at end of file
... ...
amda_plus/amdalib/mex_h_spec_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_spec_init.pro
... ... @@ -0,0 +1,71 @@
  1 +;====================================================
  2 +; VEX_h_spec_init
  3 +; 1.0
  4 +; Init module of "h_spec" object
  5 +; HPSPEC from IMAEXTRA product VEX
  6 +;
  7 +; 18 Mars 2009
  8 +;----------------------------------------------------
  9 +
  10 +pro mex_h_spec_init, ANODE = Anode, STOP_ANODE = Stop_Anode, elevationAsTime = elevationAsTime, $
  11 + LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  12 + ; spectra
  13 + MINCOUNT = minCount, MAXCOUNT = maxCount, BACKGRDCHAN = backgrdChan, BACKGRDVAL = backgrdVal, $
  14 + CHANNEL = channel, Energy = energy, ENERGYMIN = energymin, ENERGYMAX = energymax, $
  15 +
  16 + DELAY = delay, $
  17 + ; all additional keywords
  18 + _EXTRA = e
  19 +
  20 + common Request, List, StartTime, TimeInt
  21 + common GraphC, graph, GraphN, Item
  22 +
  23 + AzMin = 0
  24 + AzMax = 15
  25 +
  26 + elevation = 1;
  27 + if (KEYWORD_SET(elevationAsTime)) then elevation = 0;
  28 +
  29 + if (KEYWORD_SET(ANODE)) then begin
  30 + AzMin = Anode
  31 + if (KEYWORD_SET(STOP_ANODE)) then AzMax = Stop_Anode $
  32 + else AzMax = -1;
  33 + endif
  34 +
  35 + graph(GraphN).Type = 'IMA_T'
  36 + graph(GraphN).DataN = 1
  37 + graph(GraphN).SetCommonF(0) = 'ima_h_spec_com, "mex"'
  38 + graph(GraphN).GetDataF(0) = 'get_imam_h_spec'
  39 + graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 36100.0D0
  40 +
  41 +EnMin = 1.0;
  42 +EnMax = 25000.0;
  43 +
  44 +energyTitle = '';
  45 +
  46 +if (KEYWORD_SET(ENERGYMIN)) then begin
  47 + EnMin = energymin;
  48 + EnMax = energymax;
  49 + energyTitle = energymin eq energymax ? '!C E ' + string(energymin,format='(f7.1)') + 'eV' : '!C E ' + string(energymin,format='(f7.1)') + '-'+ string(energymax,format='(f7.1)') + 'eV';
  50 +
  51 + options = '"mex", ' + string(AzMin) +','+string(AzMax) +','+string(EnMin) +','+string(EnMax)+ ',' + string(elevation);;
  52 +
  53 + angleTitle = AzMax GT AzMin ? 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)') +'-'+ string(AzMax,format='(i2.2)') : 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)');
  54 +
  55 + graph[GraphN].AxisF = KEYWORD_SET(lin) ? 'lineaxis, 0' : 'logaxis';
  56 + graph[GraphN].Ly.title = 'MEX H Cnts ' + angleTitle + energyTitle
  57 +
  58 + graph[GraphN].PlotF = 'imacntplot,' + options
  59 +endif else begin
  60 + options = '"mex",'+string(AzMin) +','+string(AzMax) + ',' + string(elevation);
  61 +
  62 + graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  63 + *(graph[GraphN].names) = 'log Counts'
  64 +
  65 +
  66 + graph[GraphN].Ly.title = AzMax GT AzMin ? 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)') +'-'+ string(AzMax,format='(i2.2)') +'!CE/Q, eV' : 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)') + '!C E/Q, eV'
  67 + graph[GraphN].PlotF = 'imaspecplot,' + options
  68 +endelse
  69 +return
  70 +end
  71 +;------------------------------------------------------------
... ...
amda_plus/amdalib/mex_h_spec_restr_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_spec_restr_.pro
... ... @@ -0,0 +1,63 @@
  1 +function mex_h_spec_restr_, StartTime, TimeInt, Time, RetSize, Sampling, close=close
  2 +common GraphC, graph, GraphN
  3 +common MEX_H_COM, ID, Energy
  4 +
  5 +FORWARD_FUNCTION gfl
  6 +
  7 + FillValue = !Values.F_NAN
  8 +
  9 + if n_elements(ID) EQ 0 then begin
  10 + ID = -1L
  11 + err = call_external(!PROJLIB + 'libplanetcom.so','SetMission_idl', 'mex');
  12 + err = call_external(!PROJLIB + 'libplanetcom.so','SetRestriction');
  13 + EnNum = 96
  14 + Energy = fltarr(EnNum)
  15 + err = call_external(!PROJLIB + 'imainfo.so','GetImaEner_idl', Energy, 0)
  16 + Energy = temporary(Energy(where(Energy GT 0)));
  17 + endif
  18 +
  19 + sampling = 192.0;
  20 +
  21 + Size = long(graph[GraphN].DeltaT/sampling)
  22 +
  23 + Time=dblarr(Size)
  24 + SpectraTot = fltarr(16, 96, 16, 2, Size)
  25 + Product = 'HPSPEC';
  26 + PaccArr = intarr(Size);
  27 + EnergyTab = intarr(Size);
  28 +
  29 + RetSize = call_external(!PROJLIB + 'libImaExtra.so','GetImaExtra_idl',$
  30 + ID, StartTime, TimeInt,$
  31 + Product, Size, $
  32 + Time, PaccArr, EnergyTab, SpectraTot)
  33 +
  34 +
  35 + if KEYWORD_SET(CLOSE) then begin
  36 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  37 + ID = -1L
  38 + endif
  39 +
  40 + if (RetSize LE 0) then begin
  41 + Time = 0.D0
  42 + return, replicate(0.0, 96)
  43 + endif
  44 +
  45 + Spectra = fltarr(16, 96, 16, RetSize);
  46 +
  47 + for i = 0, RetSize - 1 do $
  48 + for j = 0, N_elements(Energy) - 1 do begin
  49 + GFeff = gfl(Energy[j], PaccArr[i], 1.0);
  50 + GFeffG = gfl(Energy[j], PaccArr[i], 0.0); Ghost
  51 +
  52 + coeffH = GFeff GT 0 ? 1.e-5/GFeff : 0.0;
  53 + coeffG = GFeffG GT 0 ? 1.e-5/GFeffG : 0.0;
  54 +
  55 + Spectra[*,j,*,i] = SpectraTot[*,j,*,0,i]*coeffH + SpectraTot[*,j,*,1,i] * coeffG;
  56 + endfor
  57 +
  58 +
  59 + SpectraOut = total(total(Spectra,1),2);
  60 + Time=Time[0:Retsize-1]
  61 +
  62 +return, SpectraOut
  63 +end
0 64 \ No newline at end of file
... ...
amda_plus/amdalib/mex_h_spec_restr_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_spec_restr_init.pro
... ... @@ -0,0 +1,74 @@
  1 +;====================================================
  2 +; VEX_h_spec_init
  3 +; 1.0
  4 +; Init module of "h_spec" object
  5 +; HPSPEC from IMAEXTRA product VEX
  6 +;
  7 +; 18 Mars 2009
  8 +;----------------------------------------------------
  9 +
  10 +pro mex_h_spec_restr_init, ANODE = Anode, STOP_ANODE = Stop_Anode, elevationAsTime = elevationAsTime, $
  11 + LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  12 + ; spectra
  13 + MINCOUNT = minCount, MAXCOUNT = maxCount, BACKGRDCHAN = backgrdChan, BACKGRDVAL = backgrdVal, $
  14 + CHANNEL = channel, Energy = energy, ENERGYMIN = energymin, ENERGYMAX = energymax, $
  15 +
  16 + DELAY = delay, $
  17 + ; all additional keywords
  18 + _EXTRA = e
  19 +
  20 + common Request, List, StartTime, TimeInt
  21 + common GraphC, graph, GraphN, Item
  22 +
  23 + AzMin = 0
  24 + AzMax = 15
  25 +
  26 + elevation = 1;
  27 + if (KEYWORD_SET(elevationAsTime)) then elevation = 0;
  28 +
  29 + if (KEYWORD_SET(ANODE)) then begin
  30 + AzMin = Anode
  31 + if (KEYWORD_SET(STOP_ANODE)) then AzMax = Stop_Anode $
  32 + else AzMax = -1;
  33 + endif
  34 +
  35 +
  36 + graph(GraphN).Type = 'IMA_T'
  37 + graph(GraphN).DataN = 1
  38 + graph(GraphN).SetCommonF(0) = 'ima_h_spec_com, "mex"'
  39 + graph(GraphN).GetDataF(0) = 'get_imam_h_spec, /RESTRICTED'
  40 + graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 36100.0D0
  41 +
  42 +
  43 +EnMin = 1.0;
  44 +EnMax = 25000.0;
  45 +
  46 +energyTitle = '';
  47 +
  48 +
  49 +if (KEYWORD_SET(ENERGYMIN)) then begin
  50 + EnMin = energymin;
  51 + EnMax = energymax;
  52 + energyTitle = energymin eq energymax ? '!C E ' + string(energymin,format='(f7.1)') + 'eV' : '!C E ' + string(energymin,format='(f7.1)') + '-'+ string(energymax,format='(f7.1)') + 'eV';
  53 +
  54 + options = '"mex", ' + string(AzMin) +','+string(AzMax) +','+string(EnMin) +','+string(EnMax) + ',' + string(elevation);
  55 +
  56 + angleTitle = AzMax GT AzMin ? 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)') +'-'+ string(AzMax,format='(i2.2)') : 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)');
  57 +
  58 + graph[GraphN].AxisF = KEYWORD_SET(lin) ? 'lineaxis, 0' : 'logaxis';
  59 + graph[GraphN].Ly.title = 'MEX H Cnts ' + angleTitle + energyTitle
  60 +
  61 + graph[GraphN].PlotF = 'imacntplot,' + options
  62 +endif else begin
  63 + options = '"mex",'+string(AzMin) +','+string(AzMax) + ',' + string(elevation);
  64 +
  65 + graph[GraphN].names = PTR_NEW(/ALLOCATE_HEAP)
  66 + *(graph[GraphN].names) = 'log Counts'
  67 +
  68 +
  69 + graph[GraphN].Ly.title = AzMax GT AzMin ? 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)') +'-'+ string(AzMax,format='(i2.2)') +'!CE/Q, eV' : 'MEX IMA H+ An'+ string(AzMin,format='(i2.2)') + '!C E/Q, eV'
  70 + graph[GraphN].PlotF = 'imaspecplot,' + options
  71 +endelse
  72 +return
  73 +end
  74 +;------------------------------------------------------------
... ...
amda_plus/amdalib/mex_h_temp_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_temp_init.pro
... ... @@ -0,0 +1,33 @@
  1 +;--------------------------------------
  2 +;
  3 +;---------------------------------------
  4 +
  5 +pro mex_h_temp_INIT, $
  6 + LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  7 + ; vector
  8 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  9 + DELAY = delay, $
  10 +
  11 + ; all additional keywords
  12 + _EXTRA = e
  13 +
  14 +common GraphC, graph, GraphN, Item
  15 +
  16 + pen = !dnc-1 & symbol = -3;
  17 +
  18 + if (KEYWORD_SET(COLOR)) then pen = color;
  19 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  20 +
  21 +graph[GraphN].Type = 'FGM_T'
  22 +graph[GraphN].DataN = 1
  23 +graph[GraphN].SetCommonF[0] = 'vexmex_temp_com, "mex", "h"'
  24 +graph[GraphN].GetDataF[0] ='get_vexmex_temp, "mex", "h"'
  25 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 18000.0D0
  26 +graph[GraphN].Ly.title = 'MEX ima-H T VSO, eV'
  27 +graph[GraphN].PlotF = 'PlotScal_New, 0,' + string(pen) + ',' + string(symbol);
  28 +if (KEYWORD_SET(LOG)) then AxisF = 'logaxis' $
  29 +else AxisF = 'lineaxis, ' + string(Graph[GraphN].TotalTime);
  30 +graph[GraphN].AxisF = AxisF;
  31 +
  32 +return
  33 +end
... ...
amda_plus/amdalib/mex_h_temp_restr_.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_temp_restr_.pro
... ... @@ -0,0 +1,48 @@
  1 +function MEX_H_TEMP_RESTR_, StartTime, TimeInt, Time, RetSize, Sampling, close=close
  2 +common GraphC, graph, GraphN
  3 +common MEXHDTEMP_COM, ID
  4 +
  5 + FillValue = !Values.F_NAN
  6 + if n_elements(ID) EQ 0 then ID = -1L
  7 + sampling = 192.0
  8 + Size = long(graph[GraphN].DeltaT/sampling)
  9 +
  10 + Bdata=fltarr(3,Size)
  11 + Time=dblarr(Size)
  12 +
  13 + VI = 'mex:imaparam:restricted'
  14 + ParamName = "Temperature_P";
  15 +
  16 + RetSize = call_external(!PROJLIB + 'libParam.so', 'getLocalData', $
  17 + ID, VI, ParamName, StartTime, TimeInt, Size, Time, Bdata)
  18 +
  19 +
  20 + if KEYWORD_SET(CLOSE) then begin
  21 + error = call_external(!DDLIB+'DD_idl.so','CloseID',ID)
  22 + ID = -1L
  23 + endif
  24 +
  25 + if (RetSize LE 0) then begin
  26 + Time = 0.D0
  27 + return, 0.0
  28 + endif
  29 +
  30 + Time=Time[0:Retsize-1]
  31 + Bdata=Bdata[*,0:Retsize-1]
  32 +
  33 + num_gap = where(finite(Bdata[0,*]), Cntr)
  34 +
  35 + if Cntr le 0 then begin
  36 + Retsize = -999
  37 + Time = 0.D0
  38 + return, 0.0
  39 + endif
  40 +
  41 + Time=Time[num_gap]
  42 + Bdata=Bdata[*,num_gap];
  43 + Retsize=Cntr
  44 + B = fltarr(Retsize)
  45 +
  46 + for i = 0, Retsize - 1 do B[i] = min(Bdata[*,i])
  47 +return, B
  48 +end
0 49 \ No newline at end of file
... ...
amda_plus/amdalib/mex_h_temp_restr_init.pro 0 → 100644
  1 +++ a/amda_plus/amdalib/mex_h_temp_restr_init.pro
... ... @@ -0,0 +1,31 @@
  1 +;--------------------------------------
  2 +;
  3 +;---------------------------------------
  4 +
  5 +pro mex_h_temp_RESTR_INIT, $
  6 + LOG = log, LIN = lin, PSYM = psym, COLOR = color, AY1TITLE = AY1Title, $
  7 + ; vector
  8 + X = x, Y = y, Z = z, TOTAL = total, FRAME = frame, $
  9 + DELAY = delay, $
  10 +
  11 + ; all additional keywords
  12 + _EXTRA = e
  13 +
  14 +common GraphC, graph, GraphN, Item
  15 +
  16 + pen = !dnc-1 & symbol = -3;
  17 +
  18 + if (KEYWORD_SET(COLOR)) then pen = color;
  19 + if (KEYWORD_SET(PSYM)) then symbol = psym;
  20 +
  21 +graph[GraphN].Type = 'FGM_T'
  22 +graph[GraphN].DataN = 1
  23 +graph[GraphN].SetCommonF[0] = 'vexmex_temp_com, "mex", "h"'
  24 +graph[GraphN].GetDataF[0] ='get_vexmex_temp, "mex", "h", /RESTRICTED'
  25 +graph[GraphN].DeltaT = (Graph[GraphN].TotalTime + 60.0D0) < 18000.0D0
  26 +graph[GraphN].Ly.title = 'MEX ima-H T VSO, eV'
  27 +graph[GraphN].PlotF = 'PlotScal_New, 0,' + string(pen) + ',' + string(symbol);
  28 +graph[GraphN].AxisF = 'lineaxis,' + string(graph[graphN].TotalTime)
  29 +
  30 +return
  31 +end
... ...