a2000omni.pro 1.99 KB
pro a2000omni, Time, Orbit

  StepDefaut = 3600.0
  FillValue = -1.e31
  Number = N_elements(Time)
  Bgsm = fltarr(3)
  xyz = fltarr(3)
  

  num31 = where(Orbit[0,*] ne FillValue, Index31)
  if (Index31 le 0) then return

  Time = Time[num31]
  Orbit = Orbit[*,num31]

 ; StepAve = (Time[Number-1] - Time[0])/20.0 > StepDefaut
  StepAve = StepDefaut;
  TimeIntDst = StepAve > 3600.;
  TimeIntDstS = call_external(!DDLIB + 'DD_idl.so','GetTime', double(TimeIntDst), /S_Value)
  StepAveS = call_external(!DDLIB + 'DD_idl.so','GetTime', double(StepAve), /S_Value)
      
      
      bm = fltarr(3);
      bdd = fltarr(3,7);
      UT = lonarr(7);
 
   p = [2., 1., 1., 1., 1., 1., 1.];
   result = call_external(!PROJLIB + 'a2012fa_idl.so', 'pstatus', p);
   for TimeCurr = Time[0], Time[Number-1], double(StepAve) do begin

        numOrb = where((Time - TimeCurr LT StepAve) AND (Time - TimeCurr GE 0.0), IndexOrb)
        if (IndexOrb LE 0) then continue
        
        params = sw_monitor_a99_omni_(TimeCurr,StepAve,Orbit[*,numOrb[IndexOrb/2]])
        STime = call_external(!DDLIB + 'DD_idl.so','GetTime', double(TimeCurr+StepAve/2.0), /S_Value)
       
         AE = ae_(STime, StepAveS, TimeDst, RetSize, Sampling, /CLOSE);
         AL = RetSize GT 0 ? mean(AE[1,*]) : -100.0;
  
        Dst = dst_(STime, TimeIntDstS, TimeDst, RetSize, Sampling, /CLOSE);
        Dst_av = RetSize GT 0 ? mean(Dst) : -10.;
        ro = params[0];
        v = params[1];
        bimf =params[2:4];

        for i = 0, IndexOrb - 1 do begin 
          res = call_external(!DDLIB + 'DD_idl.so','GetGavTime', UT, double(TimeCurr+StepAve/2.0));
         
	  x = Orbit[*,numOrb[i]];      
  
          result = call_external(!PROJLIB + 'a2012fa_idl.so', 'model',  $
                                                UT[0], UT[1], UT[2], float(UT[3]),$
						ro, v, bimf, Dst_av, AL, $
					        x, bm, bdd);
          if bm[0] eq 0.0 then bm(*) = FillValue ;  
          Orbit[*,numOrb[i]] = bm;        
        endfor         
  endfor

 return
end