[Previous]
[Next]
PROJECT:
SXI-M Ground Data System
NAME:
SXI_021_HDR
PURPOSE:
Convert a Level-0 FITS header to a Level-1 FITS header.
(Should be upgraded to use index structures rather than string arrays.)
EXPLANATION:
TBS
CALLING SEQUENCE:
SXI_021_HDR,hdr0,hdr1
INPUTS:
hdr0 = input header (level-0) as string array
template = master header for level-1 as string array
OUTPUTS:
result=hdr1 = new level-1 header as string array
OPTIONAL INPUT KEYWORDS:
N/A
EXTERNAL CALLS:
SXI_SXMODPAR (special array input version of SXMODPAR)
CALLED BY:
SXIM_PREP
METHOD:
TBS
CALLS: ***
SXI_SXMODPAR [1], SXI_SXMODPAR [2], SXPAR [1], SXPAR [2], SXPAR [3]
HISTORY:
Version 1.x
Written by Steven Hill at NOAA/SEC 30 Jan 2001
Modified by Steven Hill 14 Mar 2001 to really be only a header
template loader.
[Previous]
[Next]
PROJECT:
SXI-M Ground Data System
NAME:
SXI_021_HDR
PURPOSE:
Convert a Level-0 FITS header to a Level-1 FITS header.
(Should be upgraded to use index structures rather than string arrays.)
EXPLANATION:
TBS
CALLING SEQUENCE:
SXI_021_HDR,hdr0,hdr1
INPUTS:
hdr0 = input header (level-0) as string array
template = master header for level-1 as string array
OUTPUTS:
result=hdr1 = new level-1 header as string array
OPTIONAL INPUT KEYWORDS:
N/A
EXTERNAL CALLS:
SXI_SXMODPAR (special array input version of SXMODPAR)
CALLED BY:
SXIM_PREP
METHOD:
TBS
HISTORY:
Version 1.x
001.000 Written by Steven Hill at NOAA/SEC 30 Jan 2001
001.001 Modified by Steven Hill 14 Mar 2001 to really be only a header
template loader.
001.002 Modified by SMH 2002/05/16
Added HASS_TMP and MIRR_TMP pass-throughs
Added RSFF_DEC (decimal version of RSLT_SFF)
[Previous]
[Next]
sxi_arcs2pix.pro
A support routine for sxi-M to convert from arcseconds
to pixel coordinates
Inputs
xarcs: the x-coordinate in arcseconds
yarcs: the y-coordinate in arcseconds
fitshdr: a string array of the fits header
for the image needing the pixel coordinates
deltasecs: optional to tell me time difference (in seconds)
between the date/time when (xarcs,yarcs) were defined
and the date/time of the image needing the pixel coordinates
this routine will calculate the rotation and apply
to the coordinates before returning the result
Output
returns a 2d array with the pixel coordinates
(TODO future version - allow an array of coordinates to be passed and returned)
CALLS:
CALLED BY
sxi_hel2pix
[Previous]
[Next]
PROJECT:
SXI-M Ground Data System
NAME:
SXI_DESPIKE (function)
PURPOSE:
Remove spikes and particle tracks from SXI raw images.
EXPLANATION:
TBS
CALLING SEQUENCE:
result=sxim_despike,image,threshold
INPUTS:
image = 2-D image array (float or integer) to be cleaned
OUTPUTS:
result = Cleaned 2-D image array (float)
OPTIONAL INPUT KEYWORDS:
THRESHOLD = Median filter threshold for good pixel map
EXTERNAL CALLS:
TBS
CALLED BY:
SXIM_PREP
METHOD:
TBS
CALLS: ***
SXI_DESPIKE
HISTORY:
Written by Steven Hill at NOAA/SEC, 5 May 2000
VERSION
003.003 Modified by SMH 8/24/2001
Set default threshold to 5, which is good for background images.
Added parameter to return number of pixels fixed.
003.200 Modified by SMH 02/01/2001
Now optionally returns list of pixels that were de-spiked
003.201 Modified by SMH 05/17/2002
Added ability to turn off median filtering by setting
threshold to -1
Changed the program name from sxim_despike to sxi_despike
[Previous]
[Next]
sxi_hel2arcs.pro
A support routine for sxi-M/idac to convert from pixel
coordinates to heliographic coordinates
Inputs
latitude - heliographic
longitude - heliographic
fitshdr: a string array of the fits header
Output
returns the arcseconds coordinates corresponding
to the heliogrpahic coordinates as a 2d array
where negative means south/east and positive means
north/west
Error return
'Error' will be returned if something fails
(TODO future version - allow an array of coordinates to be passed and returned)
(TODO future version - handle PA,RV coordinates)
CALLS:
CALLED BY
sxi_hel2pix
[Previous]
[Next]
sxi_hel2pix.pro
A support routine for sxi-M/idac to convert from
heliographic coordinates to pixel coordinates
Inputs
latitude: the latitude to convert
longitude: the longitude to conver
fitshdr: a string array of the fits header
Output
returns the pixel coordinates corresponding
to the heliographic coordinates as an array
Error return
'Error' will be returned if something fails
(TODO future version - allow an array of coordinates to be passed and returned)
TODO: Currently only supporting points on the disk, but need to be
able to support PA,RV in the future
CALLS:
CALLED BY
sxi_arcs2pix, sxipng_arcs2pix
[Previous]
[Next]
Name : sxi_interp()
Purpose: : do linear interpolation on each column of data in the
512x512 data array d1 (a Level-0 SXI FITS image array)
Inputs : crit = Max number of -1 data points acceptable for
interpolation to be done on a column
d1 = Level-0 SXI FITS image array (512x512)
Output : d2 = Resulting 512x512 array, containing interpolated
data if interpolation was done, or median-smoothed
d1 if not
d3 = Number of pixels missing in d1
Return value : Number of -1 data points that were replaced by
interpolated values
Contact : sgreer@sec.noaa.gov
Modified : Steve Hill 14 Mar 2001 to include initial missing pixel count (d3)
: SMH 11/6/2001 - now interpolates over zeroes and -1's
; SMH 02/06/2002 - removed above change. Interpolation is not the
; right approach.
CALLS:
CALLED BY
SXIG12_PREP
[Previous]
[Next]
Written by Steven M. Hill, NOAA/SEC, 5/3/2001
CALLED BY
MAKE_BKGD, SXIG12_PREP, sxig12_browsegen
[Previous]
[Next]
PURPOSE: Extract SXI filename information into a structure
CALLS: ***
GET_DELIM
CALLED BY:
MAKE_BKGD, SXIG12_READ [1], SXIG12_READ [2], SXIG12_READ_ONE [1]
SXIG12_READ_ONE [2], sxig12_browsegen
HISTORY:
1.000 Written by SMH 2001-Jul-06
1.001 Modified by SMH 2002-May-15
Added code to allow input of full filename inluding
directory. Also, simplified code using RSI IDL
strtok function to extract fields
[Previous]
[Next]
sxi_parv2pix.pro
A support routine for sxi-M to convert from
(position angle, radius vector) to pixel coordinates
Inputs
pa: position angle (degrees CCW relative to solar north)
rv: radius vector (solar radii above the limb)
fitshdr: a string array of the fits header
for the image needing the pixel coordinates
Output
returns a 2d array with the pixel coordinates
Comment
pa is converted to (pa mod 360) to keep the range legitimate
rv should be 0.0 when on the limb and should rarely be more than
0.5 on SXI images. This routine could return a correct result
even if rv is out of range, but I decided to limit the range
of the returned value to [0,511] - so any values less than 0
are set to 0 and any values greater than 511 are set to 511
(TODO future version - allow an array of coordinates to be passed and returned)
CALLS:
[Previous]
[Next]
sxi_pix2arcs.pro
A support routine for sxi-M to convert from pixel
coordinates to arcseconds coordinates
Inputs
xpix: the x-coordinate of the pixel
ypix: the y-coordinate of the pixel
fitshdr: a string array of the fits header
Output
returns a 2d array with the arcsecs coodinates
Error return
'Error' will be returned if something fails
(TODO future version - allow an array of coordinates to be passed and returned)
CALLS:
[Previous]
[Next]
sxi_pix2hel.pro
A support routine for sxi-M/idac to convert from pixel
coordinates to heliographic coordinates
Inputs
x: the x-coordinate of the pixel
y: the y-coordinate of the pixel
fitshdr: a string array of the fits header
Output -- Revised by SG 5/28/2002
Returns a floating point array of 3 elements
0 - Flag to distinguish between heliographic
coords and PA,RV coords. (0.=heliogr,1.=PA,RV)
1 - Latitutde, if heliographic, otherwise PA
2 - Longitude, if heliographic, otherwise RV
Error return
returns with -1 if an error occurs
(TODO future version - allow an array of coordinates to be passed and returned)
CALLS:
CALLED BY
sxi_arcs2pix, sxipng_arcs2pix
[Previous]
[Next]
NAME:
SXI_SXMODPAR
PURPOSE:
Add or modify a parameter in a FITS header array.
CALLING SEQUENCE:
sxi_sxmodpar, Header, Name, Value, Comment, [ Location,
BEFORE =, AFTER = , FORMAT= ]
INPUTS:
Header = String array containing FITS header. Max string length must be
equal to 80. If not defined, then SXADDPAR will create an
empty FITS header array.
Name = Name of parameter. If Name is already in the header the value
and possibly comment fields are modified. Otherwise a new
record is added to the header. If name = 'HISTORY' then the
value will be added to the record without replacement. In
this case the comment parameter is ignored.
Value = Value for parameter. The value expression must be of the
correct type, e.g. integer, floating or string. String values
of 'T' or 'F' are considered logical values.
OPTIONAL INPUT PARAMETERS:
Comment = String field. The '/' is added by this routine. Added
starting in position 31. If not supplied, or set equal to
'', then the previous comment field is retained (when found)
Location = Keyword string name. The parameter will be placed before the
location of this keyword. This parameter is identical to
the BEFORE keyword and is kept only for consistency with
earlier versions of SXADDPAR.
OPTIONAL INPUT KEYWORD PARAMETERS:
BEFORE = Keyword string name. The parameter will be placed before the
location of this keyword. For example, if BEFORE='HISTORY'
then the parameter will be placed before the first history
location. This applies only when adding a new keyword;
keywords already in the header are kept in the same position.
AFTER = Same as BEFORE, but the parameter will be placed after the
location of this keyword. This keyword takes precedence over
BEFORE.
FORMAT = Specifies FORTRAN-like format for parameter, e.g. "F7.3". A
scalar string should be used. For complex numbers the format
should be defined so that it can be applied separately to the
real and imaginary parts.
OUTPUTS:
Header = updated FITS header array.
CALLED BY:
SXIG12_PREP, SXIG12_READ [1], SXIG12_READ [2], SXIG12_READ_ONE [1]
SXIG12_READ_ONE [2], SXI_021_HDR [1]
RESTRICTIONS:
Warning -- Parameters and names are not checked
against valid FITS parameter names, values and types.
MODIFICATION HISTORY:
DMS, RSI, July, 1983.
D. Lindler Oct. 86 Added longer string value capability
Converted to NEWIDL D. Lindler April 90
Added Format keyword, J. Isensee, July, 1990
Added keywords BEFORE and AFTER. K. Venkatakrishna, May '92
Fix comment copy for VALUE extending beyond col 32, V J Pizzo, Mar '00
[Previous]
[Next]
NAME:
SXI_SXMODPAR
PURPOSE:
Add or modify a parameter in a FITS header array.
CALLING SEQUENCE:
sxi_sxmodpar, Header, Name, Value, Comment, [ Location,
BEFORE =, AFTER = , FORMAT= ]
INPUTS:
Header = String array containing FITS header. Max string length must be
equal to 80. If not defined, then SXADDPAR will create an
empty FITS header array.
Name = Name of parameter. If Name is already in the header the value
and possibly comment fields are modified. Otherwise a new
record is added to the header. If name = 'HISTORY' then the
value will be added to the record without replacement. In
this case the comment parameter is ignored.
Value = Value for parameter. The value expression must be of the
correct type, e.g. integer, floating or string. String values
of 'T' or 'F' are considered logical values.
OPTIONAL INPUT PARAMETERS:
Comment = String field. The '/' is added by this routine. Added
starting in position 31. If not supplied, or set equal to
'', then the previous comment field is retained (when found)
Location = Keyword string name. The parameter will be placed before the
location of this keyword. This parameter is identical to
the BEFORE keyword and is kept only for consistency with
earlier versions of SXADDPAR.
OPTIONAL INPUT KEYWORD PARAMETERS:
BEFORE = Keyword string name. The parameter will be placed before the
location of this keyword. For example, if BEFORE='HISTORY'
then the parameter will be placed before the first history
location. This applies only when adding a new keyword;
keywords already in the header are kept in the same position.
AFTER = Same as BEFORE, but the parameter will be placed after the
location of this keyword. This keyword takes precedence over
BEFORE.
FORMAT = Specifies FORTRAN-like format for parameter, e.g. "F7.3". A
scalar string should be used. For complex numbers the format
should be defined so that it can be applied separately to the
real and imaginary parts.
OUTPUTS:
Header = updated FITS header array.
CALLED BY:
SXIG12_PREP, SXIG12_READ [1], SXIG12_READ [2], SXIG12_READ_ONE [1]
SXIG12_READ_ONE [2], SXI_021_HDR [1]
RESTRICTIONS:
Warning -- Parameters and names are not checked
against valid FITS parameter names, values and types.
MODIFICATION HISTORY:
DMS, RSI, July, 1983.
D. Lindler Oct. 86 Added longer string value capability
Converted to NEWIDL D. Lindler April 90
Added Format keyword, J. Isensee, July, 1990
Added keywords BEFORE and AFTER. K. Venkatakrishna, May '92
Fix comment copy for VALUE extending beyond col 32, V J Pizzo, Mar '00
[Previous]
[Next]
003.001 Modified by SMH 6/11/2002
Added default linear scaling for level-0 images
Removed 'browse_msg' as a parameter passed to sxig12_make_browse
003.002 Modified by SMH 6/11/2002
Added backup for level-1 image_code determination
003.003 Modified by SMH 6/23/2002
Added missing=0 keyword to ROT IDL procedure to avoid
extrapolation beyond CCD edge in PNG files
003.004 Modified by SMH 1/22/2003
Added error trap for Level-1 MCPSI and XPDIAG files
003.005 Modified by SMH 1/22/2003
Added 'catch' for error handling.
003.006 Modified by SMH 4/21/2003
Set /noscale keyword in SXIG12_READ.PRO, started using
SXIG12_READ_ONE.PRO for level-1 files.
Also, added saturated pixel replacement where applicable.
CALLS:
[Previous]
[Next]
Convert DN to photons based on MCP gain voltage
DN x DN2PH = PHOTONS, i.e., DN2PH is the number of DN per photon
detected
Modified 4/14/2003 SMH
Changed to reflect exponential function that better fits
the gains we are using instead of the old power law fit.
[Previous]
[Next]
PROJECT:
GOES-12 Solar X-ray Imager (SXI)
NAME:
SXIG12_PREP
PURPOSE:
Apply corrections and calibrations to raw images.
EXPLANATION:
TBS
CALLING SEQUENCE:
sxig12_prep,input_path,input_filename,output_path,output_filename,image_type, $
INPUTS:
input_filename = name of level-0 FITS file to read (string)
input_path = name of input directory (string)
OUTPUTS:
output_filename = name of level-1 FITS file to write
output_path = name of output directory (string)
OPTIONAL INPUT KEYWORDS:
N/A
EXTERNAL CALLS:
FAKE_IMAGES,filename,fake,replace_file
HEAD2STC,header (function)
IMAGE_STATISTICS,image1 (function)
MAKE_GIFS,image,index,image_type,image_level,gif,stamp
READFITS,input_filename,header,exten_no=exten_no (function)
SXI_021_HDR,input_header,master_header,statistics,image_type
SXIM_FILL,image,counter1,counter2 (function)
SXIM_DESPIKE,image0 (function)
WRITEFITS,output_filename,image,header
CALLED BY:
SXIM_BATCH or operational Python code
METHOD:
TBS
CALLS: ***
BIN_DATE, IMAGE_STATS, LONG_TIME_STR, ROT, SXDELPAR [1], SXDELPAR [2], SXDELPAR [3]
SXIG12_GET_BG, SXIG12_READ [1], SXIG12_READ [2], SXIG12_READ_ONE [1]
SXIG12_READ_ONE [2], SXIG12_SATPIX, SXIG12_ZEROPIX, SXI_DESPIKE
SXI_SXMODPAR [1], SXI_SXMODPAR [2], WRITEFITS [1], WRITEFITS [2], anytim2jd
fitshead2struct, sxi_interp, sxi_make_name
HISTORY:
003.000 Modified by SMH 8/6/2001
Added IDL error reset if backgrounds aren't found by
IDL code. This special handling simplifies python driver code.
003.001 Modified by VJP 8/13/2001
added background correction logic: sxim_bkgd
changed linear interpolation in time between short and long bkgd
put in new flat (with correct y-coord)
eliminated registration step for non-sun image PNGs
003.002 Modified by SMH 8/14/2001
Fixed typo in code to get long dark file
Updated version code written to L-1 FITS header
003.003 Modified by SMH 8/24/2001
Applies despike threshold of 5 and updates relevant keywords.
003.004 Modified by SMH 8/27/2001
Added handling for negative or zero MCP voltages.
003.005 Modified by SMH 8/28/2001
Swapped XCEN and YCEN and changed sign for CROTA correct
to correct image registration in level-1 PNG
003.006 Modified by SMH 9/04/2001
Added logic to do sqrt scaling (gamma=0.5) for linearly
scaled non-radshld images
003.007 Modified by SMH 9/05/2001
Added count for saturated pixels (SAT_PIX FITS keyword)
003.008 Modified by SMH 9/19/2001
make_browse now does constant scaling
003.009 Modified by SMH 9/19/2001
Changed sign on CROTA derotation code below
003.010 Modified by SMH 9/21/2001
Moved image statistics out of non-dark frame logic-block
so stats will be computed for dark frames.
003.011 Modified by SMH 9/21/2001
Changed gamma levels from 0.5 to 1.0 for linear images
Goes along with changes to make_browse.pro
003.012 Modified by SMH 10/3/2001
Fixed problem of loading dark file names into L1 FITS
header.
003.100 Modified by SMH 10/29/2001
Many updates: broke out background processing into
separate routine, cleaned up extraneous code, improved
comments.
003.101 Modified by SMH 10/30/2001
Replaced flat001.bin with flat002_pc.bin. Earlier flat
was improperly oriented.
003.102 Modified by SMH 11/6/2001
Modified sxim_interp.pro to interpolate over zeroes in
addition to -1's. Our main problem is proton events,
not data drops.
003.103 Modified by SMH 11/19/2001
Changed make_browse level-1 scaling displayed on PNGs
003.200 Modified by SMH 02/01/2002
Added FITS extensions for pixels affected by saturation,
leaky reference pixels, TLM dropouts, median filtering.
003.201 Modified by SMH 02/06/2002
Changed name from SXIM_PREP to SXIG12_PREP to conform to
new naming standard.
Included usage of SXIG12_READ to handle file errors, e.g.,
files with no image array etc.
Corrected an error with extensions header defaults for
NAXIS1
Extracted PNG product generation into SXIG12_browsegen
003.202 Modified by SMH 05/16/2002
Removed history prior to version 3.000
Removed call to SXIM_BKGD for dark frame processing
Set BSCALE to 1 to represent DN/S as output units. This was
done because of the high uncertainties in absolute calibration
003.203 Modified by SMH 05/21/2001
Changed output_filename so that it now includes the '.FTS' extension
003.204 Modified by SMH 05/29/2002
Changed so that an error in Image_Type results in 'NA' being put
in the level-1 FITS header
003.205 Modified by SMH 6/11/2002
Updated sxig12_get_bg call, set default scaleoption on sxig12_read to
'LIN' so that LOG images are converted to a linear scale
Changed code so that LOG images have average of model background
subtracted. This helps beat down the digitization noise on the
backgrounds since they were taken with the linear amplifier.
003.206 Modified by SMH 6/11/2002
Changed sxig12_make_browse to include backup for level-1 image
code determination
003.207 Modified by SMH 6/12/2002
No change to this file, but changed date-time format in browse
images (sxi_make_browse) to be more compatible with SQL and
CCSDS formats.
003.208 Modified by SMH 6/13/2002
No change to this file, but changed sxig12_read so that old FITS keywords,
e.g., CROTA, are updated in both the header parameter and in the
index keyword paramter
003.209 Modified by SMH 6/23/2002
No change to this file, but fixed coordinate and sign errors with
HASS corrections in sxig12_read.pro
003.210 Modified by SMH 6/23/2002
No change to this file, but in sxig12_browsegen:
Added missing=0 keyword to ROT IDL procedure to avoid
extrapolation beyond CCD edge in PNG files
003.211 Modified by SMH 6/25/2002
Fixed error in computation of FIXPIX array that led to
failures, particularly for windowed images and those
with RFI problems.
003.212 Modified by SMH 6/27/2002
Fixed index1.FILENAME so that the *.FTS extension was
no longer included.
003.213 Modified by SMH 1/17/2003
Removed return for DARK FRAMES. We want to process them
to have statistics in the meta-data. Updated Level-1 header
template, used to not fill 80 columns on END statement.
Added code to include DN values for saturated pixels taken
from nearest short exposure image in SAT_PIX extension.
003.214 Modified by SMH 1/22/2003
Ensured that dark frames are converted to floating point.
Added 'catch' error handler to replace ON_IOERROR handler
A little clean up on IO (e.g. /get_lun etc.)
003.215 Modified by SMH 1/23/2003
Made correction so that satpix is not undefined when
last_file = 'NULL'
--commented out change because of production string problem
003.300 Modified by SMH 1/23/2003
Fixed bugs with sat_pix extension.
003.310 Modified by SMH 4/22/2003
Upgrades external to this routine:
Better background model based on post PLT data
Background subtraction for 'OPEN' light leak
Improved error handling in SXI FITS read programs
Hardcoded BSCALE=1.0
[Previous]
[Next]
PROJECT:
GOES-12 Solar X-ray Imager (SXI)
NAME:
SXIG12_READ
PURPOSE:
Program to read a single SXI image, either Level-0
EXPLANATION:
TBS
CALLING SEQUENCE:
result=sxig12_read,filename,header,index=index,fn_struct=fn_struct, $
NO_SCALE=NO_SCALE,OUTPUTSCALING=OUTPUTSCALING
INPUTS:
filename = name of level-0 FITS file to read (string)
(may inlcude full directory path)
OUTPUTS:
image = TBD
header = FITS primary header as a string array
OPTIONAL KEYWORDS:
return_index = Named variable to contain header converted
into a structure
fn_struct = Named variable to contain file name converted
into a structure
noscale = If set, no scaling of the data is done (same
as 'no_scale' keyword in readfits.pro
scaleoption = LIN: LINEAR SCALING
LOG: LOG SCALING
hasshdr = Named variable to contain HASS extension header
as a string array
hassstruct = Named variable to contain HASS extension header
converted into a structure
hassdata = Named variable to contain HASS data
EXTERNAL CALLS:
TBD
CALLED BY:
SXIM_BATCH or operational Python code
METHOD:
TBS
CALLS: ***
READFITS [1], READFITS [2], READFITS [3], SXI_SXMODPAR [1], SXI_SXMODPAR [2]
fitshead2struct, sxi_parse_name
CALLED BY:
SXIG12_PREP, sxig12_browsegen
HISTORY:
003.001 Modified by SMH 6/10/2002
Updated HASS offsets and fixed code so CRPIX2 is always updated
when YCEN is updated
003.002 Modified by SMH 6/11/2002
Added linear to log and log to linear conversion code
003.003 Modified by SMH 6/13/2002
Corrected problem that only the index values and not the header
values were being updated regarding pointing for old versions
of level-0 input files
003.004 Modified by JV 6/18/2002
Fixed problem with HASS correction version identification
Was 003.500, is 003.006
003.005 Modified by SMH 6/23/2002
Corrected sign and coordinate errors in HASS corrections
NEED TO ADD LEVEL-0 HASS EXTENSION READING
NEED TO ADD LIN/LOG CONVERSION
NEED TO ADD LEVEL-1 READING
003.006 Modified by SMH 1/22/2003
Added patch for not reading HASS extension on MCPSI products.
Should also verify VERLEVL0 value for replacing pointing keywords!!!
003.007 Modified by SG 2/11/2003
Uses templates and pointers for FITSHEAD2STRUCT calls.
003.008 Modified by SMH 2/24/2003
1) Added branches to allow command line use without pointers and
without templates
2) Added check on existance of HASS data to avoid fatal errors
3) Updated version check on replacing HASS data - was 4.100,
should have been, and now is, 4.006. This caused no problem
because the algorithm in the PP and here produced the same
results.
[Previous]
[Next]
PROJECT:
GOES-12 Solar X-ray Imager (SXI)
NAME:
SXIG12_READ
PURPOSE:
Program to read a single SXI image, either Level-0
EXPLANATION:
TBS
CALLING SEQUENCE:
result=sxig12_read,filename,header,index=index,fn_struct=fn_struct, $
NO_SCALE=NO_SCALE,OUTPUTSCALING=OUTPUTSCALING
INPUTS:
filename = name of level-0 FITS file to read (string)
(may inlcude full directory path)
OUTPUTS:
image = TBD
header = FITS primary header as a string array
OPTIONAL KEYWORDS:
return_index = Named variable to contain header converted
into a structure
fn_struct = Named variable to contain file name converted
into a structure
noscale = If set, no scaling of the data is done (same
as 'no_scale' keyword in readfits.pro
scaleoption = LIN: LINEAR SCALING
LOG: LOG SCALING
hasshdr = Named variable to contain HASS extension header
as a string array
hassstruct = Named variable to contain HASS extension header
converted into a structure
hassdata = Named variable to contain HASS data
EXTERNAL CALLS:
TBD
CALLED BY:
SXIM_BATCH or operational Python code
METHOD:
TBS
CALLS: ***
READFITS [1], READFITS [2], READFITS [3], SXI_SXMODPAR [1], SXI_SXMODPAR [2]
fitshead2struct, sxi_parse_name
CALLED BY:
SXIG12_PREP, sxig12_browsegen
HISTORY:
003.001 Modified by SMH 6/10/2002
Updated HASS offsets and fixed code so CRPIX2 is always updated
when YCEN is updated
003.002 Modified by SMH 6/11/2002
Added linear to log and log to linear conversion code
003.003 Modified by SMH 6/13/2002
Corrected problem that only the index values and not the header
values were being updated regarding pointing for old versions
of level-0 input files
003.004 Modified by JV 6/18/2002
Fixed problem with HASS correction version identification
Was 003.500, is 003.006
003.005 Modified by SMH 6/23/2002
Corrected sign and coordinate errors in HASS corrections
NEED TO ADD LEVEL-0 HASS EXTENSION READING
NEED TO ADD LIN/LOG CONVERSION
NEED TO ADD LEVEL-1 READING
003.006 Modified by SMH 1/22/2003
Added patch for not reading HASS extension on MCPSI products.
Should also verify VERLEVL0 value for replacing pointing keywords!!!
003.007 Modified by SG 2/11/2003
Uses templates and pointers for FITSHEAD2STRUCT calls.
003.008 Modified by SMH 2/24/2003
1) Added branches to allow command line use without pointers and
without templates
2) Added check on existance of HASS data to avoid fatal errors
3) Updated version check on replacing HASS data - was 4.100,
should have been, and now is, 4.006. This caused no problem
because the algorithm in the PP and here produced the same
results.
[Previous]
[Next]
PROJECT:
GOES-12 Solar X-ray Imager (SXI)
NAME:
SXIG12_READ_ONE
PURPOSE:
Program to read and return a single Level One SXI image and optionally, its extensions
EXPLANATION:
TBS
CALLING SEQUENCE:
result=sxig12_read_one,filename,header,index=index,fn_struct=fn_struct, $
NO_SCALE=NO_SCALE, $
SAT_PIX_HDR =SAT_PIX_HDR ,SAT_PIX_STR =SAT_PIX_STR ,SAT_PIX_DAT =SAT_PIX_DAT ,$
ZERO_PIX_HDR=ZERO_PIX_HDR,ZERO_PIX_STR=ZERO_PIX_STR,ZERO_PIX_DAT=ZERO_PIX_DAT,$
MISS_PIX_HDR=MISS_PIX_HDR,MISS_PIX_STR=MISS_PIX_STR,MISS_PIX_DAT=MISS_PIX_DAT,$
FIX_PIX_HDR =FIX_PIX_HDR ,FIX_PIX_STR =FIX_PIX_STR ,FIX_PIX_DAT =FIX_PIX_DAT ,$
MED_PIX_HDR =MED_PIX_HDR ,MED_PIX_STR =MED_PIX_STR ,MED_PIX_DAT =MED_PIX_DAT
INPUTS:
filename = name of level-1 FITS file to read (string)
(may inlcude full directory path)
OUTPUTS:
image = 512x512 floating point array
header = FITS primary header as a string array
OPTIONAL KEYWORDS:
index = Named variable to contain header converted
into a structure
fn_struct = Named variable to contain file name converted
into a structure
noscale = If set, no scaling of the data is done (same
as 'no_scale' keyword in readfits.pro
Saturated pixel information - These are pixels that have saturated the CCD
and have a signal level of 1023 in the raw data. Nearest neighbors of
the saturated pixels are also affected and are included in this list.
SAT_PIX_HDR = Named variable to contain 1st extension header
SAT_PIX_STR = Named variable to contain 1st extension header converted
into a structure
SAT_PIX_DAT = Named variable to contain 1st extension data array
Zero value pixel information - These are pixels that have a value of zero
in the raw data due to over subtraction of a reference signal in the instrument
ZERO_PIX_HDR = Named variable to contain 2nd extension header
ZERO_PIX_STR = Named variable to contain 2nd extension header converted
into a structure
ZERO_PIX_DAT = Named variable to contain 2nd extension data array
Missing pixel information - These are pixels that were missing from the raw
data array, usually due to telemetry problems. They are represented as
-1 in the raw (Level-0) data
MISS_PIX_HDR = Named variable to contain 1st extension header
MISS_PIX_STR = Named variable to contain 1st extension header converted
into a structure
MISS_PIX_DAT = Named variable to contain 1st extension data array
Fixed pixel information - These are missing pixels that have been 'corrected'
using interopolation.
FIX_PIX_HDR = Named variable to contain 1st extension header
FIX_PIX_STR = Named variable to contain 1st extension header converted
into a structure
FIX_PIX_DAT = Named variable to contain 1st extension data array
Median filtered pixel information - These are pixels that have been affected
by application of a thresholeded median filter. This process was turned off
in for generation of Version Code B Level-1 files.
MED_PIX_HDR = Named variable to contain 1st extension header
MED_PIX_STR = Named variable to contain 1st extension header converted
into a structure
MED_PIX_DAT = Named variable to contain 1st extension data array
EXTERNAL CALLS:
TBD
CALLED BY:
METHOD:
CALLS: ***
READFITS [1], READFITS [2], READFITS [3], SXI_SXMODPAR [1], SXI_SXMODPAR [2]
fitshead2struct, sxi_parse_name
CALLED BY:
SXIG12_PREP, mreadfits_sxig12, sxig12_browsegen
HISTORY:
003.000 Created by SMH 7/05/2002
003.001a Modified by SMH 1/21/2003
Inserted keywords CROTACN1=0 and CROTACN2=0 for mapping package conformance.
003.002a Modified by SMH 1/23/2003
Added logic to skip extensions in Level-1 FITS files from version 3.213 to 3.215
because the extensions may be corrupted.
003.001b Modified by SG 2/11/2003
Added structure templates (using pointers) for FITSHEAD2STRUCT calls
003.002b Modified by SMH 2/24/2003
Added branches to allow command line use without pointers and
without templates
003.003 Modified by SMH 3/4/2003
Merged versions 3.002a and 3.002b
[Previous]
[Next]
PROJECT:
GOES-12 Solar X-ray Imager (SXI)
NAME:
SXIG12_READ_ONE
PURPOSE:
Program to read and return a single Level One SXI image and optionally, its extensions
EXPLANATION:
TBS
CALLING SEQUENCE:
result=sxig12_read_one,filename,header,index=index,fn_struct=fn_struct, $
NO_SCALE=NO_SCALE, $
SAT_PIX_HDR =SAT_PIX_HDR ,SAT_PIX_STR =SAT_PIX_STR ,SAT_PIX_DAT =SAT_PIX_DAT ,$
ZERO_PIX_HDR=ZERO_PIX_HDR,ZERO_PIX_STR=ZERO_PIX_STR,ZERO_PIX_DAT=ZERO_PIX_DAT,$
MISS_PIX_HDR=MISS_PIX_HDR,MISS_PIX_STR=MISS_PIX_STR,MISS_PIX_DAT=MISS_PIX_DAT,$
FIX_PIX_HDR =FIX_PIX_HDR ,FIX_PIX_STR =FIX_PIX_STR ,FIX_PIX_DAT =FIX_PIX_DAT ,$
MED_PIX_HDR =MED_PIX_HDR ,MED_PIX_STR =MED_PIX_STR ,MED_PIX_DAT =MED_PIX_DAT
INPUTS:
filename = name of level-1 FITS file to read (string)
(may inlcude full directory path)
OUTPUTS:
image = 512x512 floating point array
header = FITS primary header as a string array
OPTIONAL KEYWORDS:
index = Named variable to contain header converted
into a structure
fn_struct = Named variable to contain file name converted
into a structure
noscale = If set, no scaling of the data is done (same
as 'no_scale' keyword in readfits.pro
Saturated pixel information - These are pixels that have saturated the CCD
and have a signal level of 1023 in the raw data. Nearest neighbors of
the saturated pixels are also affected and are included in this list.
SAT_PIX_HDR = Named variable to contain 1st extension header
SAT_PIX_STR = Named variable to contain 1st extension header converted
into a structure
SAT_PIX_DAT = Named variable to contain 1st extension data array
Zero value pixel information - These are pixels that have a value of zero
in the raw data due to over subtraction of a reference signal in the instrument
ZERO_PIX_HDR = Named variable to contain 2nd extension header
ZERO_PIX_STR = Named variable to contain 2nd extension header converted
into a structure
ZERO_PIX_DAT = Named variable to contain 2nd extension data array
Missing pixel information - These are pixels that were missing from the raw
data array, usually due to telemetry problems. They are represented as
-1 in the raw (Level-0) data
MISS_PIX_HDR = Named variable to contain 1st extension header
MISS_PIX_STR = Named variable to contain 1st extension header converted
into a structure
MISS_PIX_DAT = Named variable to contain 1st extension data array
Fixed pixel information - These are missing pixels that have been 'corrected'
using interopolation.
FIX_PIX_HDR = Named variable to contain 1st extension header
FIX_PIX_STR = Named variable to contain 1st extension header converted
into a structure
FIX_PIX_DAT = Named variable to contain 1st extension data array
Median filtered pixel information - These are pixels that have been affected
by application of a thresholeded median filter. This process was turned off
in for generation of Version Code B Level-1 files.
MED_PIX_HDR = Named variable to contain 1st extension header
MED_PIX_STR = Named variable to contain 1st extension header converted
into a structure
MED_PIX_DAT = Named variable to contain 1st extension data array
EXTERNAL CALLS:
TBD
CALLED BY:
METHOD:
CALLS: ***
READFITS [1], READFITS [2], READFITS [3], SXI_SXMODPAR [1], SXI_SXMODPAR [2]
fitshead2struct, sxi_parse_name
CALLED BY:
SXIG12_PREP, mreadfits_sxig12, sxig12_browsegen
HISTORY:
003.000 Created by SMH 7/05/2002
003.001a Modified by SMH 1/21/2003
Inserted keywords CROTACN1=0 and CROTACN2=0 for mapping package conformance.
003.002a Modified by SMH 1/23/2003
Added logic to skip extensions in Level-1 FITS files from version 3.213 to 3.215
because the extensions may be corrupted.
003.001b Modified by SG 2/11/2003
Added structure templates (using pointers) for FITSHEAD2STRUCT calls
003.002b Modified by SMH 2/24/2003
Added branches to allow command line use without pointers and
without templates
003.003 Modified by SMH 3/4/2003
Merged versions 3.002a and 3.002b
[Previous]
[Next]
sxipng_arcs2pix.pro
A support routine for sxi-M to convert from arcseconds
to pixel coordinates
Inputs
xarcs: the x-coordinate in arcseconds
yarcs: the y-coordinate in arcseconds
fitshdr: a string array of the fits header
for the image needing the pixel coordinates
deltasecs: optional to tell me time difference (in seconds)
between the date/time when (xarcs,yarcs) were defined
and the date/time of the image needing the pixel coordinates
this routine will calculate the rotation and apply
to the coordinates before returning the result
Output
returns a 2d array with the pixel coordinates
(TODO future version - allow an array of coordinates to be passed and returned)
Assumes:
process that generates png files places the 512x512 sxi
data in the same part of the image as it did on 19 Feb 2003
that the image is derotated, so that north is up
that the filename convention is SXI_yyyymmdd_hhmmss*
that we can ignore the milliseconds
CALLS:
CALLED BY
sxipng_hel2pix
[Previous]
[Next]
sxipng_hel2arcs.pro
A support routine for sxi-M/idac to convert from pixel
coordinates to heliographic coordinates for level-1
png images
Inputs
latitude - heliographic
longitude - heliographic
filename: the level-1 image filename
Output
returns the arcseconds coordinates corresponding
to the heliogrpahic coordinates as a 2d array
where negative means south/east and positive means
north/west
Error return
'Error' will be returned if something fails
Assumes:
process that generates png files places the 512x512 sxi
data in the same part of the image as it did on 19 Feb 2003
that the image is derotated, so that north is up
that the filename convention is SXI_yyyymmdd_hhmmss*
that we can ignore the milliseconds
(TODO future version - allow an array of coordinates to be passed and returned)
(TODO future version - handle PA,RV coordinates)
CALLS:
CALLED BY
sxipng_hel2pix
[Previous]
[Next]
sxipng_hel2pix.pro
A support routine for sxi-M/idac to convert from
heliographic coordinates to pixel coordinates
for level-1 png images
Inputs
latitude: the latitude to convert
longitude: the longitude to conver
filename: the name of the png image file
Output
returns the pixel coordinates corresponding
to the heliographic coordinates as a 2d array
Error return
'Error' will be returned if something fails
Assumes:
process that generates png files places the 512x512 sxi
data in the same part of the image as it did on 19 Feb 2003
that the image is derotated, so that north is up
that the filename convention is SXI_yyyymmdd_hhmmss*
that we can ignore the milliseconds
CALLS:
[Previous]
[Next]
sxipng_parv2pix.pro
A support routine for sxi-M to convert from
(position angle, radius vector) to pixel coordinates
for the level-1 png images
Inputs
pa: position angle (degrees CCW relative to solar north)
rv: radius vector (solar radii above the limb)
filename: the filename of the level-1 image
Output
returns a 2d array with the pixel coordinates
Comment
pa is converted to (pa mod 360) to keep the range legitimate
rv should be 0.0 when on the limb and should rarely be more than
0.5 on SXI images. This routine could return a correct result
even if rv is out of range, but I decided to limit the range
of the returned value to [0,511] - so any values less than 0
are set to 0 and any values greater than 511 are set to 511
Assumes:
process that generates png files places the 512x512 sxi
data in the same part of the image as it did on 19 Feb 2003
that the image is derotated, so that north is up
that the filename convention is SXI_yyyymmdd_hhmmss*
that we can ignore the milliseconds
CALLS:
[Previous]
[Next]
sxipng_pix2arcs.pro
A support routine for sxi-M to convert from pixel
coordinates to arcseconds coordinates for the level-1
png images
Inputs
xpix: the x-coordinate of the pixel
ypix: the y-coordinate of the pixel
filename: the level-1 image filename
Output
returns a 2d array with the arcsecs coodinates
Error return
'Error' will be returned if something fails
Assumes:
process that generates png files places the 512x512 sxi
data in the same part of the image as it did on 19 Feb 2003
that the image is derotated, so that north is up
that the filename convention is SXI_yyyymmdd_hhmmss*
that we can ignore the milliseconds
[Previous]
[Next]
sxipng_pix2hel.pro
A support routine for sxi-M/idac to convert from pixel
coordinates to heliographic coordinates for the level-1
png images
Inputs
x: the x-coordinate of the pixel
y: the y-coordinate of the pixel
filename: the level-1 image filename
Output
returns the heliographic coordinates corresponding
to the pixel coordinates as a 2d array: (Lat, Lon),
where negative means south/east and positive means
north/west
Error return
returns -1 if an error occurs (or point is off disk)
Assumes:
process that generates png files places the 512x512 sxi
data in the same part of the image as it did on 19 Feb 2003
that the image is derotated, so that north is up
that the filename convention is SXI_yyyymmdd_hhmmss*
that we can ignore the milliseconds
[Previous]
[Next]
sxipng_pix2helstr.pro
A support routine for sxi-M/idac to convert from pixel
coordinates to heliographic coordinates for the level-1
png images
Inputs
x: the x-coordinate of the pixel
y: the y-coordinate of the pixel
filename: the level-1 image filename
Output
returns a string of the heliographic coordinates corresponding
to the pixel coordinates
Error return
'Error' will be returned if something fails
Assumes:
process that generates png files places the 512x512 sxi
data in the same part of the image as it did on 19 Feb 2003
that the image is derotated, so that north is up
that the filename convention is SXI_yyyymmdd_hhmmss*
that we can ignore the milliseconds
CALLS: