Huairou IDL Programs Online Help

Last modified: Thur Dec 12 16:07:09 2002.


List of Routines


Routine Descriptions

CFF1N

[Next Routine] [List of Routines]
 NAME :	CFF1N (procedure)
 PURPOSE :
	calculate current-free field based on the longitudinal
	field (BL) in rdata (planar geometry)
 CATEGORY :
	solar magnetic field computation package (MAGPACK2)
 CALLING SEQUENCE :
	cff1n, Bl, bxp, byp
 INPUTS :
	Bl   -- longitudinal magnetic field
 OPTIONAL INPUT PARAMETERS :
	none
 KEYWORD PARAMETERS :
	position  :  position on the solar disk, [ ew, ns ]
			 disk center => [0,0],  limb => +-1.
	dx    : scale of 1 pixel in unit of 10000km
 OUTPUTS :
	bxp, byp : current-free transverse fields
 COMMON BLOCKS : 	none
 SIDE EFFECTS : 	mparam will be modified
 RESTRICTIONS :	none
 PROCEDURE :
	use FFT to calculate current-free fields
 MODIFICATION HISTORY :
	T.Sakurai, 1992
	K.Ichimoto, 92/10/17   modify cff1.pro

CFF1N.pro


FIT2DAT

[Next Routine] [List of Routines]
NAME :	fit2dat.pro (procedure)

PURPOSE :  
	Translate data of HSOS from Fits format to dat format

CATEGORY : 
	IDL/HSOS 

CALLING SEQUENCE:
	IDL> fit2dat

        or (eg.)
	IDL> fit2dat, infile='L50213612020817.fit', outfile='l512136a.dat'

KEYWORD PARAMETERS: 
	infile: Fits data name
	outfile: dat file name
	data: 512 X 512
	info: information of the observation
SUBROUTINE: READFITS.PRO

RESTRICTIONS:
	ONLY FOR MAGNETOGRAM FITS DATA OF HSOS

NOTE: the output information is less than which in FITS header  

MODIFICATION HISTORY
2002-7-8	Liu Yu, write

fit2dat.pro


HR_CALIB

[Previous Routine] [Next Routine] [List of Routines]
 NAME :    HR_CALIB.pro (procedure)
 PURPOSE :
   Calibrate the observed magnetic field data by the Huairou Solar Observation
		Station, correct for seeing (if set fseeing ne 1.0), show the vector magnetogram
		on the screen, or save it to a .ps file when set /saveps, or output the calibrated data
		to a FITS file given by FITSOUT keyword
 CATEGORY :
   idl/huairou
 CALLING SEQUENCE :
   hr_calib,lname,qname,uname,bx,by,bz,angle,head,nx=nx,ny=ny,sname=sname,$
       saveps=saveps,dir=dir,ext=ext,nstep=nstep,magnify=magnify,xsize=xsize,$
       fseeing=fseeing,ocenter=ocenter,qshift=qshift,ushift=ushift,/btonly,$
       /old,/blonly,/btcont,/fitsout
 INPUTS :
   lname: file name of Stokes V profile data without extension
   qname: file name of Stokes Q profile data without extension
   uname: file name of Stokes U profile data without extension
 OPTIONAL INPUT PARAMETERS :
	none
 OUTPUTS :
   bx: tranverse magnetic field component in X direction (Gauss)
   by: tranverse magnetic field component in Y direction (Gauss)
   bz: longitudinal magnetic field (Gauss)
   angle: azimuthal angle of Bt
	head: head information. 12 by 3 or 4 (if set /sname) string array
 KEYWORD PARAMETERS :
   nx = nx: demanded pixel number in X direction. default: nx=170
   ny = ny: demanded pixel number in Y direction. default: nx=120
   old=old: if set, use the old method when calibrating Bt.
            i.e., Bt=60000*sqrt(Q^2+U^2). default: Bt=9370*sqrt(sqrt(Q^2+U^2))
   dir=dir: directory where the observed data files are stored
   ext=ext: extension of the file names. default: '.dat'
   saveps : if set, save the aftermath in a PostScript file
   btonly : if set, show transversal field component only
   blonly : if set, show longitudinal field component only
   nstep  : step increase to plot transversal field. default: nstep=10
   sname  : spot file name. if set, display spot image as background
   magnify: magnifying factor when showing the magnetogram. default: =3
   btcont : if set, show the transversal field as contours
   fseeing: factor for seeing correct. default: =1.0
   xsize  : size (cm) in X direction when save PostScript file
   fitsout: if set, save the calibrated data in a FITS file. (head(*,0:2),bx,by,bz,angle)
			 the file name is 'HByymmdd.hhmm.fit' where yymmdd.hhmm is the observing
			 date and time in UT (hhmm)
   ocenter: two-element array containing the latitude & longitude of the center
            of the observed region (>0 for North and West). default: use the
            the value from file header provided by LNAME.
   qshift : two-element array containing required shift in X & Y direction
            for Q component. default = [0,0]
   ushift : two-element array containing required shift in X & Y direction
            for U component. default = [0,0]
 COMMON BLOCKS :   none
 SIDE EFFECTS :
 RESTRICTIONS :
 PROCEDURE :

 MODIFICATION HISTORY :
   2000/10/27  Hui LI, write
	2001/05/21  Hui LI, add /ocenter, /qshift & /ushift

HR_calib.pro


HR_CHGBTDIR

[Previous Routine] [Next Routine] [List of Routines]
 NAME :    HR_ChgBtDir.pro (procedure)
 PURPOSE :
   Manually adjust directions of the transverse component of the vector magnetic field
 CATEGORY :
   idl/huairou
 CALLING SEQUENCE :
   hr_ChgBtDir,fname,oname,rect=rect,dir=dir,ext=ext,nstep=nstep,/blackgnd
 INPUTS :
   fname: FITS file name of calibrated data without extension
 OPTIONAL INPUT PARAMETERS :
   oname: FITS file to containing the corrected field given by ONAME. If ONAME is not
			presented, write to FNAME instead.
 OUTPUTS :
   Write the corrected field to a FITS file
 KEYWORD PARAMETERS :
	rect=  : four-element integer array containing initial [xx,yy,dx,dy]
	dir=dir: directory where the observed data files are stored
	ext=ext: extension of the file names. default: '.dat'
	nstep  : step increment to plot transversal field. default: nstep=15
	blackgnd: if set, set the background to black
 COMMON BLOCKS :   none
 SIDE EFFECTS :
 RESTRICTIONS :
	This procedure requires a 3-Button mouse working properly
 PROCEDURE :

 MODIFICATION HISTORY :
   Hui LI, write on 2001/03/06

HR_chgbtdir.pro


HR_CURRENT

[Previous Routine] [Next Routine] [List of Routines]
 NAME : HR_CURRENT.pro (procedure)
 PURPOSE :
	Calculate the vertical current from calibrated Huairou magnetic field data saved in a
		FITS format file. Write it to a FITS file if set /FITSOUT
 CATEGORY :
	idl/huairou
 CALLING SEQUENCE :
	hr_current,fname,current,dir=dir,ext=ext,smth=smth,/fitsout,/fourier
 INPUTS :
	fname: FITS file name containing the calibrated magnetic field data without extension
 OPTIONAL INPUT PARAMETERS :
	none
 OUTPUTS :
	current: calculated vertical current (Ampere/m^2)
 KEYWORD PARAMETERS :
	dir=dir: directory where the file is located. default: current directory.
	ext=ext: extension of the file. default: 'fit'
	fourier: if set, use FFT method to calculate the current. default: difference
	smth   : smooth the result by a square of SMOOTH by SMOOTH pixel if set
	fitsout: if set, write the result in a FITS format file named CURRhhmm.fit, where
			 hh and mm are hour and minute of the observation time in UT.
 COMMON BLOCKS :   none
 SIDE EFFECTS :
 RESTRICTIONS :
	call hr_calib to calibrate the data before call this procedure to calculate
	the vertical current
 PROCEDURE :
	readfits, writefits, sxpar and sxaddpar are called
 MODIFICATION HISTORY :
   Hui LI, write on 2001/02/26

HR_current.pro


HR_MAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME :    HR_Mag.pro (procedure)
 PURPOSE :
   Make a vector magnetogram from calibrated Huairou magnetic field data saved in FITS
	format file.
 CATEGORY :
   idl/huairou
 CALLING SEQUENCE :
   hr_mag,fname,back=back,saveps=saveps,dir=dir,ext=ext,magnify=magnify,$
		nstep=nstep,level=level,/btonly,/blonly,/btcont,/blackgnd
 INPUTS :
   fname: FITS file name of calibrated data without extension
 OPTIONAL INPUT PARAMETERS :
   none
 OUTPUTS :
   Show the magnetogram on the screen or save as a .PS file if set /saveps
 KEYWORD PARAMETERS :
	back = : a file name in Huairou data format OR a variable containing the background
	         image (e,g, photospheric spot image); OR just set this keyword to show the
	         spot image in the read-in FITS file as the background.
	dir=dir: directory where the observed data files are stored
	ext=ext: extension of the file names. default: '.dat'
	saveps : if set, save the aftermath in a PostScript file
	btonly : if set, show transversal field component only
	blonly : if set, show longitudinal field component only
	nstep  : step increase to plot transversal field. default: nstep=10
	magnify: magnifying factor when showing the magnetogram. default: =3
	btcont : if set, show the transversal field as contours
	level  : contour level. default: [200,500,800,1200,1600,2000,2500,3000] for Bt contour
				and [40,80,160,320,640,960,1280,1600,1920,2240,2560,2880] for Bl contour
	blackgnd: if set, set the background to black
 COMMON BLOCKS :   none
 SIDE EFFECTS :
 RESTRICTIONS :
 PROCEDURE :

 MODIFICATION HISTORY :
   Hui LI, write on 2001/02/25

HR_mag.pro


HR_PROJ

[Previous Routine] [Next Routine] [List of Routines]
 NAME: HR_PROJ.pro (procedure)
 PURPOSE :
	Correct for the projection effect of the calibrated magnetic field data observed by the
		vector magnetograph at Huairou Station, Beijing Astronomical Observatory. Show the
		magnetogram for the corrected data on the screen when set /show or save it to a
		PostScript file when set /saveps.
 CATEGORY :
	idl/huairou
 CALLING SEQUENCE :
	hr_proj,fname,oname,BB0,LL0,xv0,yv0,ar=ar,dir=dir,ext=ext,xscale=xscale,yscale=yscale,$
			saveps=saveps,sname=sname,nstep=nstep,/origin,/show,/back
 INPUTS :
	fname: FITS file name containing the calibrated magnetic field data without extension
	oname: FITS file name to store the corrected data without extension
 OPTIONAL INPUT PARAMETERS :
	BB0  : Latitude of solar disk center (degree >0 for N, <0 for S). default bb0=b0
	LL0  : Longitude of solar disk center (degree >0 for W, <0 for E). default ll0=0.0
	xv0  : Frame X coordinate of the ROI center (0<xv0<nx-1). default=nx/2
	yv0  : Frame Y coordinate of the ROI center (0<yv0<ny-1). default=ny/2
 OUTPUTS :
	corrected data are written to a FITS file given by ONAME
 KEYWORD PARAMETERS :
	dir=dir: directory where the file is located. default: current directory.
	ext=ext: extension of the file. default: 'fit'
	ar=ar  : two-element array containing the Sun-disk coordinates (degree) of the active
			 region. defaut: get the Sun-disk coordinates from the file head
	xscale : scaling factor in X directory. default: =1.0
	yscale : scaling factor in Y directory. default: =1.0
	show   : if set, show the magnetogram for the corrected data on the screen
	saveps : if set, save the magnetogram for the corrected data in .PS file
	sname  : name of the file containing the spot (photospheric) image
	origin : if set, show/save the magnetogram before projection correcting
	nstep  : pixel interval when plotting Bt. default: nstep=10
 COMMON BLOCKS :   none
 SIDE EFFECTS :
 RESTRICTIONS :
	call hr_calib to calibrate the data before call this procedure to correct
	the projection effect for limb region
 PROCEDURE :
	readfits, writefits, bilinear, sxpar, sxaddpar and sunparam are used
 MODIFICATION HISTORY :
   Hui LI, write on 2001/02/26

HR_proj.pro


HR_READ

[Previous Routine] [Next Routine] [List of Routines]
 NAME :    HR_READ.pro (procedure)
 PURPOSE :
   Read Huairou Solar Observation Station data file
 CATEGORY :
   idl/flare
 CALLING SEQUENCE :
   hr_read,filename,data,info,swap=swap,dir=dir
 INPUTS :
   filename: name of data file to be read
 OPTIONAL INPUT PARAMETERS :
   none
 OUTPUTS :
   data: raw data
   info: 12-element string array containing the observing information
       0       spectral line
       1       date
       2       time
       3       seeing
       4       sun disc coordinate x
       5       sun disc coordinate y
       6       orthogonal coordinate x
       7       orthogonal coordinate y
       8       carrington coordinate x
       9       carrington coordinate y
       10      frame
       11      huirou number
 KEYWORD PARAMETERS :
   swap=swap: option for high-low 8-bits conversion
   dir = dir: directory where the file to be read is located
 COMMON BLOCKS :   none
 SIDE EFFECTS :
 RESTRICTIONS :
 PROCEDURE :

 MODIFICATION HISTORY :
   by X.Z. Hu
      last change date        May 11, 1995
   Sep. 28, 1997, for different Device Environment
           By Deng Y. Y.
   Option: Swap---- Judge if the data need swap
       Default: swap=0
   Hui LI, 2000/10/24 add /dir and reorganize the procedure

hr_read.pro


SUNPARAM

[Previous Routine] [List of Routines]
 NAME :	sunparam
 PURPOSE :
	calculate solar parameters 
 CATEGORY :
 	solar magnetic field computation package (MAGPACK2)
 CALLING SEQUENCE :
	sunparam, tsys, date, time, rsun, p, b0, cl0, doy
 INPUTS :
	tsys = 'GMT+hh', 'JST',,,etc.,  which indicates a timezone
	date = 'yy/mm/dd' or 'yyyymmdd', time = 'hh:mm:ss'
 OPTIONAL INPUT PARAMETERS : 
	none
 KEYWORD PARAMETERS :
	none
 OUTPUTS :
     rsun=  semidiameter in arcsec
     p   =  position angle of sun's pole in deg.
     b0  =  heliographic latitude of disk center in deg.
     cl0 =  carrington longitude of the meridian in deg.
     doy =  day of year
 COMMON BLOCKS : 	none
 SIDE EFFECTS : 	none
 RESTRICTIONS :	none
 PROCEDURE :

 MODIFICATION HISTORY :
	originally coded by K.Shibasaki 10/28/83 as koyomi/zs for OAO Melcom 70
	T.Sakurai, 1992
	           1993.2 tsys is added to argument list
		   1999.1 format of year can be 'yyyymmdd'

sunparam.pro