file: jsoc-manual.txt = RR manual for JSOC im_patch cutout service
init: Dec  8 2013  Rob Rutten  Sac Peak
last: Jun 17 2021  Rob Rutten  Deil
note: sometime 2016 this manual became obsolete, see my sdo manual 

NB: this manual is no longer used or needed <by me>
---------------------------------------------------
  This manual describes how to get SDO data for "cutouts" (= small
  fields of view matching other telescopes, e.g. the SST) using the
  im_patch service on the JSOC exportdata website.  Since spring 2016
  this isn't needed by me anymore since my sdo_orderjsoc.pro does the
  ordering from an IDL session, and my sdo_getjsoc.pro does the
  dowloading from IDL too.

  I therefore cut the below parts out of my sdo-manual.txt in case I
  still need these notes in future.


Step 1: define your desired SDO cutout sequences
------------------------------------------------
  find area of interest: from GBO data or daily movies or JHelioviewer

  define (X,Y) of cutout center precisely for the start time of the desired 
  SDO data set (solar rotation moves your target up to 10 arcsec/hr)
    sdo_featurelocator,datetime,wav,imagedir=imagedir  # find feature (X,Y)
      e.g.: sdo_featurelocator,'2014-01-01 00:00','1600'
      zoom in precisely to the recognized feature and click for coordinates   

  define JSOC series identifiers by copy-paste + editing of:
    aia.lev1_uv_24s[2013.07.29_14:00/120m][1600,1700] # start, length, wavs
    aia.lev1_euv_12s[2013.07.29_14:00/120m][304,171,193]   # or more AIA
    hmi.M_45s[2013.07.29_14:00_TAI/120m]              # magnetograms
    hmi.Ic_45s[2013.07.29_14:00_TAI/120m]             # continuum 
    hmi.V_45s[2013.07.29_14:00_TAI/120m]              # Dopplergrams

  [NB -in case of problems defining the desired sequence specifier:
  http://jsoc.stanford.edu/ajax/lookdata.html  
         click on RecordSetSelect
       paste/build series identifier into window, NO return
       click check count
       click tab on top "Export Data"
       click export button
       yes, leave this page
       click export 
       redo the exportdata page]


Step 2: get "im_patch" cutout sequences from JSOC (both AIA and HMI, fast)
--------------------------------------------------------------------------
  request the first series:
  http://jsoc.stanford.edu/ajax/exportdata.html  
     paste first series identifier into upper RecordSet window
    hit return or click Check count
    Method > url-tar
    click Enable Processing active
    click im_patch active
        keep Tracking enabled, Register and Crop not enabled
        maintain the default reference time = start time of requested series
          (NB: setting a different reference time ??may?? spoil HMI coutouts)
        set LocUnits for (X,Y) = arcsec from center (not px, 0.5/0.6)
        specify X and Y of patch center
        set box size scale: arcsec (not px)
        set box width    (for xga movies: minimum 55 or 110 or 220 or 440)
        set box height   (for xga movies: minimum 43 or  85 or 170 or 340)
    Check params in im-patch box: must have "OK to submit" behind it
    ?? Compression > Rice
    Protocol: FITS
    notify: email address
    click Check Params for Export
    click Submit Export Request when green
    ignore size estimate            # still is way too large
    wait for grey Request Export Status (or wait for email)
    note Record Set string + JSOC request number (raise page) in emdatasdojot

  request the other series (repeat for each):
    paste next series identifier into upper RecordSet window
    in im_patch box click Update Reference Times
    click again on "Check Params for Export"  # even when green
    wait until Submit Export Request is green
    click green Submit Export Request
    wait until this goes grey after red
    again note request identifier

  wait for the processing to be done or the confirmation email


Step 3: download requested data sets when ready, untar, check field of view
------------------------------------------------------------------------------
  click Request Export Status
    when data complete: right-mouse download link
  or in "export complete" email: 
    right-click > open link
    right-click > "Save as" 

  post-download shell command startup:
    mkdir datadir
    cd ~/Downloads      
    tar xf *tar
    rm -f *tar          
    cd datadir
    mkdir level1
    cd level1
    mvfromdownloads *.fits
    cd ..


RR to RR: get & process JSOC tars off-line in remote server using screen
------------------------------------------------------------------------
  in Tosh: start shadow dir
    mkdir ~/data/SDO/"date-topic"
    cd ~/data/SDO/"date-topic"
    mkdir -p  tar level1 level2 cubes mpegs
    emrecordidl (or in dir higher; comes in ~/rr/wrk/SDO/...)
  in server: get tar files and process them all all the way 
    <start terminal in remote server>
    screen
    mkdir ~/data/SDO/date-topic
    cd ~/data/SDO/date-topic
    getjsoctar http://jsoc.stanford.edu/SUM57/D526543567/S00000
    getjsoctar http://jsoc.stanford.edu/....
    getjsoctar http://jsoc.stanford.edu/....
    IDL
    sdo_allimages2fitscubes,'171',/sdoprep,/dellev1,maildone='r.j.rutten@uu.nl
       # no dellev2 for safety
    CNTRL-a d
    logout (??)
    login
    screen -r 
    exit IDL
    exit from screen and logout
  better get only the mpegs (40x smaller than intcubes, reasonable quality)