This page was created by the IDL library routine `mk_html_help2`.

Last modified: Tue Aug 5 18:17:40 2025.

# Directory Listing of Routines

# projects/kaguya/map/lmag

- KGY_CALC_BCON
  Calculates B connection between s/c and the Moon
- KGY_LMAG_COM
  stores the LMAG static memory
- KGY_READ_LMAG
  reads in Kaguya MAP/LMAG files
- KGY_SVM_COM
  stores SVM data
- KGY_SVM_GET
  Returns model lunar B vector computed from SVM (Tsunakawa et al., 2015)
- KGY_SVM_LOAD
  Downloads and reads in SVM data files
- KGY_SVM_PRED
  Computes crustal B at Kaguya positions from SVM (Tsunakawa et al., 2015)

# Routine Descriptions

## KGY_CALC_BCON

[Next Routine] [List of Routines]

     PROCEDURE:
           kgy_calc_bcon
     PURPOSE:
           Calculates B connection between s/c and the Moon
     CALLING SEQUENCE:
           kgy_calc_bcon, tvar_Rme = 'kgy_lmag_Rme', tvar_Bme = 'kgy_lmag_Bme'
     KEYWORDS:
           tvar_Rme: tplot variable of s/c position in ME coordinates
           tvar_Bme: tplot variable of B vector in ME coordinates
     Output tplot variables:
           'kgy_lmag_Bcon_flg' = Magnetic connection flag:
                                 0 (black) for no connection,
                                 1 (green) for anti-para connection (-B ==> Moon),
                                 2 (red) for parallel connection (+B ==> Moon)
           'kgy_lmag_bimpact' = distant along the field line from s/c to footpoint
           'kgy_lmag_fp_lat' = footpoint latitude in ME coordinates
           'kgy_lmag_fp_lon' = footpoint longitude in ME coordinates
           'kgy_lmag_belev' = B elevation angle from the surface at the footpoint
           'kgy_lmag_surfloc' = footpoint location (normalized by rL)
     CREATED BY:
           Yuki Harada
           - modified from 'art_bconnect_bres.pro' written by Andrew Poppe
           - tvar_Rme and tvar_Bme should have the same time array
             (time interpolation not included)

     $LastChangedBy: haraday $
     $LastChangedDate: 2016-09-18 17:19:45 -0700 (Sun, 18 Sep 2016) $
     $LastChangedRevision: 21853 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/kaguya/map/lmag/kgy_calc_bcon.pro $

(See projects/kaguya/map/lmag/kgy_calc_bcon.pro)

## KGY_LMAG_COM

[Previous Routine] [Next Routine] [List of Routines]

     COMMON BLOCK:
         kgy_lmag_com
     PURPOSE:
         stores the LMAG static memory
         lmag_*_arr: strcuture arrays which contain time (seconds since
                     1970) and vector/scalar data
     CREATED BY:
         Yuki Harada on 2014-06-29

     $LastChangedBy: haraday $
     $LastChangedDate: 2016-09-09 11:33:47 -0700 (Fri, 09 Sep 2016) $
     $LastChangedRevision: 21810 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/kaguya/map/lmag/kgy_lmag_com.pro $

(See projects/kaguya/map/lmag/kgy_lmag_com.pro)

## KGY_READ_LMAG

[Previous Routine] [Next Routine] [List of Routines]

     PROCEDURE:
         kgy_read_lmag
     PURPOSE:
         reads in Kaguya MAP/LMAG files
         and stores data in a common block (kgy_lmag_com)
     CALLING SEQUENCE:
         kgy_read_lmag, files, trange=trange
     INPUTS:
         files: full paths to the LMAG files (gziped or decompressed)
                e.g., [ 'dir/mag20080101.7.all.1sec.gz', $
                        'dir/mag20080101.7.sat.1sec.gz', $
                        'dir/mag20080101_00.7.sat.32hz.gz', ... ]
     KEYWORDS:
         trange: time range (optional, Def. all),
                 ['yyyy-mm-dd/hh:mm:ss','yyyy-mm-dd/hh:mm:ss']
                 Any format compatible with 'time_double' is acceptable.
     NOTES:
         Invalid data elements = 999.99 -> NaNs
     CREATED BY:
         Yuki Harada on 2014-06-30

     $LastChangedBy: haraday $
     $LastChangedDate: 2016-09-09 11:33:47 -0700 (Fri, 09 Sep 2016) $
     $LastChangedRevision: 21810 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/kaguya/map/lmag/kgy_read_lmag.pro $

(See projects/kaguya/map/lmag/kgy_read_lmag.pro)

## KGY_SVM_COM

[Previous Routine] [Next Routine] [List of Routines]

     PROCEDURE:
           kgy_svm_com
     PURPOSE:
           stores SVM data
     CREATED BY:
           Yuki Harada on 2018-05-02

     $LastChangedBy: haraday $
     $LastChangedDate: 2018-05-08 16:47:27 -0700 (Tue, 08 May 2018) $
     $LastChangedRevision: 25186 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/kaguya/map/lmag/kgy_svm_com.pro $

(See projects/kaguya/map/lmag/kgy_svm_com.pro)

## KGY_SVM_GET

[Previous Routine] [Next Routine] [List of Routines]

     FUNCTION:
           kgy_svm_get
     PURPOSE:
           Returns model lunar B vector computed from SVM (Tsunakawa et al., 2015)
           Works in selenographic coordinates
     CALLING SEQUENCE:
           bvec = kgy_svm_get(rvec)
     INPUT:
           rvec: 3xN array containing X, Y, Z in km
     OUTPUT:
           bvec: 3xN array containing Bx, By, Bz in nT
     CREATED BY:
           Yuki Harada on 2018-05-02
           Modified from Bcal.f90 written by H. Tsunakawa
           The original version is available at
           http://www.geo.titech.ac.jp/lab/tsunakawa/Kaguya_LMAG
     REFERENCE:
           Tsunakawa, H., F. Takahashi, H. Shimizu, H. Shibuya, and M. Matsushima (2015), Surface vector mapping of magnetic anomalies over the Moon using Kaguya and Lunar Prospector observations, J. Geophys. Res. Planets, 120, 1160–1185, doi:10.1002/2014JE004785.

     $LastChangedBy: haraday $
     $LastChangedDate: 2018-05-08 16:47:27 -0700 (Tue, 08 May 2018) $
     $LastChangedRevision: 25186 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/kaguya/map/lmag/kgy_svm_get.pro $

(See projects/kaguya/map/lmag/kgy_svm_get.pro)

## KGY_SVM_LOAD

[Previous Routine] [Next Routine] [List of Routines]

     PROCEDURE:
           kgy_svm_load
     PURPOSE:
           Downloads and reads in SVM data files
     CREATED BY:
           Yuki Harada on 2018-05-02

     $LastChangedBy: haraday $
     $LastChangedDate: 2018-05-15 00:54:22 -0700 (Tue, 15 May 2018) $
     $LastChangedRevision: 25223 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/kaguya/map/lmag/kgy_svm_load.pro $

(See projects/kaguya/map/lmag/kgy_svm_load.pro)

## KGY_SVM_PRED

[Previous Routine] [List of Routines]

     PROCEDURE:
           kgy_svm_pred
     PURPOSE:
           Computes crustal B at Kaguya positions from SVM (Tsunakawa et al., 2015)
     CALLING SEQUENCE:
           kgy_svm_pred,trange=time_double('2008-01-01/'+['02:00','04:00'])
     OPTIONAL KEYWORDS:
           trange: time range (Def: timerange())
           resolution: time resolution (Def: 4)
           spice_frame: additional output B frame
                        available frames: SELENE_M_SPACECRAFT, SSE, GSE
     CREATED BY:
           Yuki Harada on 2018-05-08

     $LastChangedBy: haraday $
     $LastChangedDate: 2018-05-15 23:37:33 -0700 (Tue, 15 May 2018) $
     $LastChangedRevision: 25226 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/kaguya/map/lmag/kgy_svm_pred.pro $

(See projects/kaguya/map/lmag/kgy_svm_pred.pro)