[Previous]
[Next]
NAME:
b3d_param
PURPOSE:
Parameters for processing magnetic source surface files
INCLUDED BY:
BField_Get, Write3D_bb, Write3D_bbtt
MODIFICATION HISTORY:
JUN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BadI1
PURPOSE:
Provides a generic identifier for integer*1 'bad values'
CATEGORY:
gen/for/lib
CALLING SEQUENCE:
integer*1 function BadI1()
INPUTS:
(none)
OUTPUTS:
BadI1 integer*1 bad integer*1 identifier
CALLS:
(none)
CALLED BY:
ArrI1Copy
SEE ALSO:
BadR4, BadR8, TinyR4, pInfR4
PROCEDURE:
The BadI1 number is currently zero.
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BadI4
PURPOSE:
Provides a generic identifier for integer*4 'bad values'
CATEGORY:
gen/for/lib
CALLING SEQUENCE:
integer function BadI4()
INPUTS:
(none)
OUTPUTS:
I integer bad integer identifier
CALLS:
(none)
CALLED BY:
ArrI4AddConstant, ArrI4AddConstant2, ArrI4Bad, ArrI4Constant, ArrI4Copy
ArrI4Copy2, ArrI4GetMinMax, ArrI4Index, ArrI4SetMinMax, ArrI4Zero
ArrR4DivideByArrI4, FileInfo, WR2DARR, WhatIsI4, WriteI4GRD, iArrI4Total, smei_base
smei_cal, smei_foreign, smei_orb, smei_skyd
SEE ALSO:
BadR4, BadR8, TinyR4, pInfR4
INCLUDE:
include 'math.h'
PROCEDURE:
The BadI4 number is pulled out of the include file.
It is set to the largest negative integer*4 number
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BadI8
PURPOSE:
Provides a generic identifier for integer*8 'bad values'
CATEGORY:
gen/for/lib
CALLING SEQUENCE:
integer*8 function BadI8()
INPUTS:
(none)
OUTPUTS:
I integer*8 bad integer identifier
CALLS:
(none)
CALLED BY:
ArrI8GetMinMax, ArrI8Zero, WhatIsI8
SEE ALSO:
BadR4, BadR8, TinyR4, pInfR4
INCLUDE:
include 'math.h'
PROCEDURE:
The BadI4 number is pulled out of the include file.
It is set to the largest negative integer*8 number
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BadR4
PURPOSE:
Provides a generic identifier for real*4 'bad values'
CATEGORY:
gen/for/lib
CALLING SEQUENCE:
function BadR4()
INPUTS:
(none)
OUTPUTS:
X real bad value number
CALLS:
(none)
CALLED BY:
ArrR4AddConstant, ArrR4Bad, ArrR4Constant, ArrR4Copy, ArrR4Copy2
ArrR4DivideByArrI4, ArrR4DivideByArrR4, ArrR4DivideByConstant, ArrR4Function
ArrR4GetMinMax, ArrR4Index, ArrR4Interpolate, ArrR4Invert, ArrR4LinearArrR4
ArrR4Mask, ArrR4Mean, ArrR4Median, ArrR4MinusArrR4, ArrR4Negate, ArrR4PlusArrR4
ArrR4Scale, ArrR4Scale2, ArrR4SetMinMax, ArrR4Stdev, ArrR4Step, ArrR4TimesArrR4
ArrR4TimesConstant, ArrR4Total, ArrR4Zero, AsymDust, Average, BListAll, BadR4Test
BuildSourceSurface, ConvertG2D, CopyDtoDVN, CopyVtoVDN, CvD2G, CvG2D, Deneq3, Dust
DustAsymmetry, ExpandSW, ExtractInsitu, ExtractMap, Extractd, Extractd3d, FLINT
FillMap, FillMapL, FillMapOLS, FillMaptN, FillWholeT, GAL_CNTR, GTODEN, GridFill
GridRan2Reg, GridReg2Reg, GridSphere3D, GridSphereRange, GridSphereWeight, HERDISK
HOSPlot, HOSPlot_EditPoints, LOSProjection, LOSTweak, MKVTRACE, MapGrid
MapReadSingle, MapReadTimes, MapWarp, MkD2V, MkDMap, MkDMaptdn, MkGModel, MkGModeltdn
MkShift, MkShiftdn, MkV2D, MkVMap, MkVMaptdN, MkVModel, MkVModeltd, MkVeltd, Mk_D2V
Mk_D2VN, Mk_V2D, Mk_V2DN, NODAT, NRGTODEN, POLYNOMIAL_EXP, PointPOnLOS
PointPOnLOS_Near, PointPOnLOS_Reset, PrintAll, READ_HOS, ReadGIPS, RebinSphere
SW_Model_Kinematic, SplineX, SplineY, T3D_fill_global, T3D_fill_time, T3D_get
T3D_get_all, T3D_get_grid, T3D_get_mode, T3D_header, T3D_iget, T3D_iset, T3D_set
T3D_set_mode, T_FILTER, TheFit, ThomsonMidpoint, ThomsonMidpointFar
ThomsonPDistance, ThomsonPDistanceFar, TimeSmooth, Veleq3, WR2DARR, WhatIsR4
Write3D_bb, Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt, Write3D_nv, Write3D_nv_UT
Write3D_nv_XC, WriteR4GRD, XMAP_SC_POS, XMAP_SC_POS8, iFltArr, iHOSArch, iHOSRead
iHOSWrite, iProcessNagoya, iProcessNagoyan, iProcessOoty, iProcessOotyn
iProcessUCSD, iReadNagoya, iReadNagoyan, iReadOoty, iReadOotyn, iReadProxyMap
iReadProxyMapN, iReadUCSD, iWriteProxyMapN, ipsd, ipsdt, ipsg2, ipsg2s, ipsg2t, nrBCUINT
shift_MOD [1], shift_MOD [2], sim_MOD, smei_base, smei_cal, smei_cal_add
smei_cal_build, smei_cal_write, smei_frm_base, smei_frm_clean, smei_frm_dark
smei_frm_measle, smei_frm_ped, smei_frm_stats, smei_orb_min, smei_orb_write
smei_skyd, smei_skyd_combine, smei_skyd_fill, smei_skyd_flush, smei_skyd_fts
smei_skyd_init, smei_skyd_make, smei_skyd_sky, smei_skyd_sort, write3D_infotd3D
SEE ALSO:
BadI4, BadR8, TinyR4, pInfR4
INCLUDE:
include 'math.h'
PROCEDURE:
The BadR4 number is pulled out of the include file.
It is set to the largest negative real*4 number on VMS
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BadR4Test
PURPOSE:
Checks real*4 variable for 'bad value'
CATEGORY:
gen/for/lib
CALLING SEQUENCE:
logical function BadR4Test(X)
INPUTS:
X real any real variable
OUTPUTS:
BadR4Test logical .TRUE. if X is bad
.FALSE. if not
CALLS: ***
BadR4
CALLED BY:
smei_base
PROCEDURE:
The BadR4 number is pulled out of the include file.
It is set to the largest negative real*4 number on VMS
MODIFICATION HISTORY:
JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BadR8
PURPOSE:
Provides a generic identifier for real*8 'bad values'
CATEGORY:
gen/for/lib
CALLING SEQUENCE:
real*8 function BadR8()
INPUTS:
(none)
OUTPUTS:
X real*8 bad value number
CALLS:
(none)
CALLED BY:
ArrR8Bad, ArrR8Copy, ArrR8Interpolate, ArrR8Zero, BadR8Test, FLINT8, TheFit
smei_axis_cam, smei_cam2ccd, smei_ccd2cam, smei_skyd_fill, smei_skyd_flush
smei_skyd_sort
SEE ALSO:
BadI4, BadR4, TinyR4, pInfR4
INCLUDE:
include 'math.h'
PROCEDURE:
The BadR8 number is pulled out of the include file.
It is set to the largest negative real*8 number on VMS
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BadR8Test
PURPOSE:
Checks double precision variable for 'bad value'
CATEGORY:
gen/for/lib
CALLING SEQUENCE:
logical function BadR8Test(X)
INPUTS:
X real*8 any real variable
OUTPUTS:
BadR8Test logical .TRUE. if X is bad
.FALSE. if not
CALLS: ***
BadR8
PROCEDURE:
The BadR8 number is pulled out of the include file.
It is set to the largest negative real*8 number on VMS
MODIFICATION HISTORY:
FEB-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bAskChar
PURPOSE:
CALLING SEQUENCE:
logical function bAskChar(bExit,bFile,bDir,bParse,cExit,cOld,cNew,cVal)
CALLED BY:
AskChar
INCLUDE:
include 'filparts.h'
CALLS: ***
iCheckDirectory, iGetFileSpec, iSearch, itrim, uppercase
[Previous]
[Next]
NAME:
bCompareStr
PURPOSE:
Comparing strings, avoiding the traps of zero-length strings
CATEGORY:
String manipulation
CALLING SEQUENCE:
logical function bCompareStr(ID,C1,C2)
INPUTS:
C1 character*(*) string to be processed
OUTPUTS:
CStr character*(*) modified string
L integer length non-trivial part of output string
CALLS: ***
icompress, itrim
SEE ALSO:
icompress, itrim, iwhitespace, lowercase, uppercase
PROCEDURE:
MODIFICATION HISTORY:
JAN-1992, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
bCompressNic
PURPOSE:
Read *.nic file, compress the image array and write to *.ice file
CATEGORY:
I/O
CALLING SEQUENCE:
logical function bCompressNic(iAct, cFile, cDir)
INPUTS:
iAct integer open specified (passed to bReadNic)
If cFile is known to be a valid *.nic file use
iAct = OPN__TRYINPUT
cFile character*(*) file name (with .nic file type)
cDir character*(*) output directory;
if cDir = ' ' then the compressed file
is put in the same directory as the input file
OUTPUTS:
bCompressNic logical .TRUE. : file compressed successfully
.FALSE.: error compressing file
(compressed file)
CALLS: ***
Int2Str, Str2Str, bReadNic, iGetFileSpec, iPutFileSpec, iSetFileSpec, ice_write, itrim
CALLED BY:
rice
RESTRICTIONS:
cDir must include a trailing backslash, i.e. C:\temp\ instead of just C:\temp
INCLUDE:
include 'openfile.h'
include 'filparts.h'
PROCEDURE:
> If cDir = ' ', then the compressed file is written into the same directory as
the original image file.
> The compressed file is written only if the compression factor is less than 0.9.
> The file name of the compressed file is the same as the original file
with the file type changed to .ice.
> The trailer information in the compressed file contains three items
separated by a carriage return, line feed pair:
- 2 integer*4 values containing the dimensions of the image file (e.g. '1280 600')
(the product nX*nY is also recorded in the header of the .ice file)
- file name and type of the input file (e.g. tmo_001.nic)
- the trailer of the original image file
MODIFICATION HISTORY:
AUG-2000, Paul Hick (UCSD; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BField_Choose
PURPOSE:
Choose type of source surface magnetic maps
CATEGORY:
Tomography
CALLING SEQUENCE:
entry BField_Choose(iVar,cVar)
INPUTS:
iVar integer # entries in cVar
cVar(iVar)*(*) character command line arguments (usually set up by
a call to ForeignArg)
OUTPUTS:
BField_Choose logical set .TRUE. if magnetic source surface data are
processed.
CALLS: ***
BList_NSO_NOAA, BList_WSO, BList_WSO_NOAA, BRead_NSO_NOAA, BRead_WSO
BRead_WSO_NOAA, ForeignFile, Say, T3D_Read_B, cHideLogical, itrim
CALLED BY:
ipsd, ipsdt
SEE ALSO:
BField_Get
PROCEDURE:
Entry point in BField_Get.
The input array cVar is searched for string like 'wso=' or
'wso_noaa=' (as defined in b3d_param.h) to decide on which types of
magnetic source surface maps to use (currently one or more of WSO,
WSO_NOAA or NSO_NOAA can be selected). If a match is found, then the
corresponding cWild entry is set. If no match is found then cWild is
set to the blank string.
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS)
JUN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Prepared for use with multiple types of magnetic source surface maps.
Made BField_Choose and entry point in bField_Get to allow saving the
cWild information internally.
[Previous]
[Next]
NAME:
BField_Get
PURPOSE:
Read magnetic source surface files
CATEGORY:
Tomography
CALLING SEQUENCE:
logical function BField_Get(iB,TTime,XCbeg,XCend,BR)
INPUTS:
iB integer identifies the type of magnetic source surface map
to be used (see include file b3d_param.h).
TTime(nTim) real (time-dependent tomography only)
Times at which magnetic field is required
XCbeg(nTim) real start Carrington variable of matrix (- NCoff)
XCend(nTim) real end Carrington variable of matrix (- NCoff)
(range of matrix typically is three Carrington rotations)
OUTPUTS:
BR(nLng,nLat,nTim) real radial magnetic fieldi
CALLS: ***
BList_NSO_NOAA, BList_WSO, BList_WSO_NOAA, BRead_NSO_NOAA, BRead_WSO
BRead_WSO_NOAA, ForeignFile, Say, T3D_Read_B, cHideLogical, itrim
CALLED BY:
Write3D_bb, Write3D_bb_UT, Write3D_bb_XC, Write3D_bbtt
SEE ALSO:
BField_Choose
EXPLICIT:
integer BList_WSO
integer BRead_WSO
integer BList_WSO_NOAA
integer BRead_WSO_NOAA
integer BList_NSO_NOAA
integer BRead_NSO_NOAA
EXTERNAL:
external BList_WSO
external BRead_WSO
external BList_WSO_NOAA
external BRead_WSO_NOAA
external BList_NSO_NOAA
external BRead_NSO_NOAA
INCLUDE:
include 'b3d_param.h'
include 'filparts.h'
PROCEDURE:
Process magnetic source surface files.
MODIFICATION HISTORY:
AUG-2002, Paul Hick (UCSD/CASS)
JUN-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added code to process NSO_NOAA maps.
[Previous]
[Next]
NAME:
bGetLun
PURPOSE:
Handle pool of logical numbers for opening files to avoid problems
with using the same logical number to open different files.
CALLING SEQUENCE:
logical function bGetLun(LU,cFile)
INPUTS:
(none)
OUTPUTS:
LU integer assigned logical unit number; FIL__NOUNIT is returned
if no unit numbers are available
bGetLun logical .TRUE. : logical unit number assigned
.FALSE.: no more unit numbers available
CALLED BY:
Extractd, Extractd3d, HOSInquire, LogModFile, OSExitCmd, iOpenFile
INCLUDE:
include 'filparts.h'
RESTRICTIONS:
Only logical unit numbers in range [LUMin,LUMax]=[30,40] are processed.
CALLS: ***
iGetLun
MODIFICATION HISTORY:
?, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bHOSName
PURPOSE:
Check whether a file name has the standard Helios format
CATEGORY:
Data processing: auxilliary
CALLING SEQUENCE:
logical function bHOSName(cFile,iSc,iYr,IC,IFL)
INPUTS:
cFile character*(*) file name (READ ONLY)
OUTPUTS:
bHOSName logical .TRUE. if standard format, .FALSE. if not
iSc integer 1/2 for Helios A/B
iYr integer year (in I4 format, e.g. 1980)
IC integer color (1/2/3 for U/B/V)
IFL integer filter (1/2/3/4/5) or 9 if 90 deg data file
CALLS: ***
iGetFileSpec, iSetFileSpec, itrim
CALLED BY:
HOSRead, Pandora, bOpenFile
INCLUDE:
include 'filparts.h'
PROCEDURE:
> The standard Helios format for a data file name is a 9 character
string containing information about s/c, year, color, filter and start
Doy, e.g. A76V4_103 contains Helios 1 (A) data for Doy 103 of year 1976
for visual light (V) and the clear filter (4).
- 1:1 tested for a,A or b,B
- 2:3 tested for 1974-1985 for Helios A, 1976-1980 for Helios B
- 4:4 tested for u,U or b,B or v,V
- 5:5 tested for 1,2,3,4,5 or 9
- 6:6 tested for underscore (_)
- 7:9 tested for 1 <= Doy <= 366
> Optional:
- 10:10 tested for underscore(_)
- 11:14 tested for Carrington rotation number
> If bHOSName = .FALSE. then iSc=iYr=IC=IFL=0 is returned
MODIFICATION HISTORY:
NOV-1991, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
bIsXEvent
PURPOSE:
Duummy function for Windows and Linux
for functions containing calls to GRPACK functions
CALLED BY:
HOSPlot, HOSPlot_DrawBase, HOSPlot_EditPoints, HOSPlot_bCommand, TheFit
PROCEDURE:
Needed by: MapReadSrf
MODIFICATION HISTORY:
JAN-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
Bit16
PURPOSE:
Put the binary representation for a integer*2 into a 16 element
integer*1 array, or v.v.
CALLING SEQUENCE:
subroutine Bit16(ID,IN,OBIT)
INPUTS:
ID integer 0 : integer ---> binary
1 : binary ---> integer
INPUTS/OUTPUTS:
IN integer*2 integer to be converted to/from binary
OBIT(16) integer*1 binary representation for IN
CALLS:
(none)
CALLED BY:
Pandora
RESTRICTIONS:
If IN is negative, two's complement convention is assumed, i.e.
bit 16 is set to one; the other 15 bits are those of the positive
number IN+32768.
PROCEDURE:
The least significant bit of IN is put into OBIT(16), the most
significant in OBIT(1), i.e. if OBIT is printed with format 16I1
the value of IN in binary results.
MODIFICATION HISTORY:
MAR-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu) : Rewrite of JBIT16
[Previous]
[Next]
NAME:
Bit2to4
PURPOSE:
Copy an integer in the range [-32768,32767] stored in an integer*2
variable into an integer*4 variable, preserving the bit pattern of
the least significant 16 bits.
CALLING SEQUENCE:
subroutine Bit2to4(I2,I4)
INPUTS:
I2 integer*2 integer in range [-32768,32767]
OUTPUTS:
I4 integer*4 result in range [0,65535]
CALLS:
(none)
CALLED BY:
Pandora
PROCEDURE:
The output integer*4 value is in the range [0,65535], i.e. the
most significant 16 bits are all zero.
MODIFICATION HISTORY:
MAR-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
Bit32
PURPOSE:
Put the binary representation for a integer*4 into a 32 element
integer*1 array or v.v.
CALLING SEQUENCE:
subroutine Bit32(ID,IN,OBIT)
INPUTS:
ID integer 0 : integer ---> binary
1 : binary ---> integer
INPUTS/OUTPUTS:
IN integer integer to be converted to binary
OBIT(32) integer*1 binary representation for IN
CALLED BY:
Pandora, cBit32
RESTRICTIONS:
If IN is negative, two's complement convention is assumed, i.e.
bit 32 is set to one; the other 31 bits are those of the positive
number IN+2147483648.
PROCEDURE:
The least significant bit of IN is put into OBIT(32), the most
significant in OBIT(1), i.e. if OBIT is printed with format 32I1
the value of IN in binary results.
MODIFICATION HISTORY:
MAR-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu) : Rewrite of JBIT16
[Previous]
[Next]
NAME:
Bit4to2
PURPOSE:
Copy the two least signficant bytes of an integer*4 into
an integer*2 variable.
CALLING SEQUENCE:
subroutine Bit4to2(I4,I2)
INPUTS:
I4 integer*4 any integer*4
OUTPUTS:
I2 integer*2 result in range [-32768,32767]
CALLS:
(none)
CALLED BY:
Pandora
PROCEDURE:
iand(I4,Z'7FFF') copies the least significant 15 bits
iand(I4,Z'FFFF')/Z'8000'=0/1 is the 16 bit
iand(I4,Z'FFFF')/Z'8000')*Z'8000' sets the sign bit of the integer*2
MODIFICATION HISTORY:
SEP-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BList_NSO_NOAA
PURPOSE:
Retrieve information about source surface file for magnetic field.
This routine applies to the WSO files we download from NOAA (courtesy
of Nick Arge).
CALLING SEQUENCE:
integer function BList_NSO_NOAA(cFile, NCoff, TFound,XCFoundBeg,XCFoundEnd,NrFound,R0,Scale)
INPUTS:
cFile*(*) character fully-qualified name of file containing
source surface map
NCoff integer Carrington offset subtracted from
TFound, XCFoundBeg, XCFoundEnd
OUTPUTS:
BList_NSO_NOAA logical return status (0=Failure,1=Success)
(actually is always 1)
TFound real Time assigned to source surface map
XCFoundBeg real Start Carrington variable
XCFoundEnd real End Carrington variable
NrFound integer version number
R0 real source surface distance (in AU)
Scale real conversion factor from muT to nT)
The data read by BRead_NSO_NOAA will be
multiplied by this constant, i.e.
BRead_NSO_NOAA returns data in nT.
CALLED BY:
BField_Choose, BField_Get
EXTERNAL BY:
BField_Get
INCLUDE:
include 'openfile.h'
include 'filparts.h'
include 'sun.h'
include 'ftspar.h'
EXTERNAL:
external EARTH
CALLS: ***
ECLIPTIC_HELIOGRAPHIC, FTCLOS, FTGKYE, FTGKYS, FTNOPN, Flt2Str, Julian, N_CARRINGTON
Say, Str2Dbl, Str2Flt, Str2Flt_Format, Str2Str, SunNewcomb, Time2Carrington
Time2Split, bOpenFile, iFilePath, iFreeLun, iGetFileSpec, iGetLun, iSetFileSpec, itrim
say_fts
SEE ALSO:
BListAll, BList_WSO, BRead_WSO_NOAA, MapReadSingle, MapReadTimes
PROCEDURE:
The WSO files from NOAA have file names of the type
wso1986_010_1.dat, i.e. containing a Carrington rotation number,
a heliographic longitude in degrees, and a file version number.
Records in the file cover latitudes from =70 to +70 degrees.
Each record is prefixed with a string of type CT1986:010.
The CR and longitude in the file name correspond to the LAST
record in the file (NOT the first as in the regular WSO files).
For the example wso1986_010_1.dat, the output values would be:
TFound = 1986+(1-10/360) - 0.152 = 1986.9722 - 0.1520 = 1986.8202
XCFoundBeg = 1985.9722
XCFoundEnd = 1986.9722
NrFound = 1
R0 = 0.069786090 (= 15 solar radii in AU)
Scale = 1000.0 (= is conversion from muT to nT)
If the date file 'datefile.dat' is present in the same
directory as the magnetic field files than the time TFound
is updated using information from that file. The first date
file we got had 152 entries for which TFound was decreased by
0.152 +/- 0.004 rotations (about -4 days).
MODIFICATION HISTORY:
JUL-2002, Paul Hick (UCSD/CASS)
AUG-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added automatic determination of data file format.
[Previous]
[Next]
NAME:
BList_WSO
PURPOSE:
Retrieve information about source surface file for magnetic field.
This routine applies to the regular WSO files downloaded from
the WSO web site.
CALLING SEQUENCE:
integer function BList_WSO(cFile, NCoff, TFound,XCFoundBeg,XCFoundEnd,NrFound,R0,Scale)
INPUTS:
cFile*(*) character fully-qualified name of file containing
source surface map
NCoff integer Carrington offset subtracted from
TFound, XCFoundBeg, XCFoundEnd
OUTPUTS:
BList_WSO integer return status (0=Failure,1=Success)
TFound real Time assigned to source surface map
XCFoundBeg real Start Carrington variable
XCFoundEnd real End Carrington variable
NrFound integer version number
R0 real source surface distance (in AU)
Scale real conversion factor from muT to nT.
The data read by BRead_WSO will be
multiplied by this constant, i.e.
BRead_WSO returns data in nT.
CALLED BY:
BField_Choose, BField_Get
EXTERNAL BY:
BField_Get
INCLUDE:
include 'openfile.h'
include 'filparts.h'
include 'sun.h'
EXTERNAL:
external EARTH
CALLS: ***
Str2Flt, iGetFileSpec, iSetFileSpec
SEE ALSO:
BListAll, BList_WSO_NOAA, BRead_WSO, MapReadSingle, MapReadTimes
PROCEDURE:
All timing information is retrieved by analyzing the
file name. The source surface distance is hardcoded.
The regular WSO files from NOAA have file names of the type
wso1986_010_1.dat, i.e. containing a Carrington rotation number,
a heliographic longitude in degrees, and (optionally) a file
version number.
Records in the file cover latitudes from -70 to +70 degrees.
Each record is prefixed with a string of type CT1986:010.
The CR and longitude in the file name correspond to the FIRST
record in the file.
For the example wso1986_010_1.dat, the output values would be:
XCFoundBeg = 1986+(1-10/360) = 1986.9722
XCFoundEnd = 1987.9722 = XCFoundBeg+1
TFound = 1987.4722 = XCFoundBeg+0.5
NrFound = 1
R0 = 0.069786090 (= 15 solar radii in AU)
Scale = 1000.0 (= is conversion from muT to nT)
MODIFICATION HISTORY:
MAY-2002, Paul Hick (UCSD/CASS)
[Previous]
[Next]
NAME:
BList_WSO_NOAA
PURPOSE:
Retrieve information about source surface file for magnetic field.
This routine applies to the WSO files we download from NOAA (courtesy
of Nick Arge).
CALLING SEQUENCE:
integer function BList_WSO_NOAA(cFile, NCoff, TFound,XCFoundBeg,XCFoundEnd,NrFound,R0,Scale)
INPUTS:
cFile*(*) character fully-qualified name of file containing
source surface map
NCoff integer Carrington offset subtracted from
TFound, XCFoundBeg, XCFoundEnd
OUTPUTS:
BList_WSO_NOAA integer return status (0=Failure,1=Success)
(actually is always 1)
TFound real Time assigned to source surface map
XCFoundBeg real Start Carrington variable
XCFoundEnd real End Carrington variable
NrFound integer version number
R0 real source surface distance (in AU)
Scale real conversion factor from muT to nT)
The data read by BRead_WSO_NOAA will be
multiplied by this constant, i.e.
BRead_WSO_NOAA returns data in nT.
CALLED BY:
BField_Choose, BField_Get
EXTERNAL BY:
BField_Get
INCLUDE:
include 'openfile.h'
include 'filparts.h'
include 'sun.h'
include 'ftspar.h'
EXTERNAL:
external EARTH
CALLS: ***
ECLIPTIC_HELIOGRAPHIC, FTCLOS, FTGKYE, FTGKYS, FTNOPN, Flt2Str, Julian, N_CARRINGTON
Say, Str2Dbl, Str2Flt, Str2Flt_Format, Str2Str, SunNewcomb, Time2Carrington
Time2Split, bOpenFile, iFilePath, iFreeLun, iGetFileSpec, iGetLun, iSetFileSpec, itrim
say_fts
SEE ALSO:
BListAll, BList_WSO, BRead_WSO_NOAA, MapReadSingle, MapReadTimes
PROCEDURE:
The WSO files from NOAA have file names of the type
wso1986_010_1.dat, i.e. containing a Carrington rotation number,
a heliographic longitude in degrees, and a file version number.
Records in the file cover latitudes from =70 to +70 degrees.
Each record is prefixed with a string of type CT1986:010.
The CR and longitude in the file name correspond to the LAST
record in the file (NOT the first as in the regular WSO files).
For the example wso1986_010_1.dat, the output values would be:
TFound = 1986+(1-10/360) - 0.152 = 1986.9722 - 0.1520 = 1986.8202
XCFoundBeg = 1985.9722
XCFoundEnd = 1986.9722
NrFound = 1
R0 = 0.069786090 (= 15 solar radii in AU)
Scale = 1000.0 (= is conversion from muT to nT)
If the date file 'datefile.dat' is present in the same
directory as the magnetic field files than the time TFound
is updated using information from that file. The first date
file we got had 152 entries for which TFound was decreased by
0.152 +/- 0.004 rotations (about -4 days).
MODIFICATION HISTORY:
JUL-2002, Paul Hick (UCSD/CASS)
AUG-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added automatic determination of data file format.
[Previous]
[Next]
NAME:
BListAll
PURPOSE:
Collect information about group of magnetic source surface files
CALLING SEQUENCE:
integer function BListAll(ID, cWild, BListFnc, NCoff, VarBeg,VarEnd,
& nFileMax, cFile,TFile,XCFileBeg,XCFileEnd,WFile,Nr,R0,Scale)
INPUTS:
ID integer 0: Check for maps containing part of Carrington range
[VarBeg,VarEnd] (used by corotating tomography)
1: Check for maps covering time range [VarBeg,VarEnd]
An attempt is made to bracket the time range
(used by time-dependent tomography)
BListFnc integer external function
cWild*(*) character wild card for locating source surface files
NCoff integer
VarBeg real start Carrington variable or time
VarEnd end Carrington variable or time
nFileMax integer max # of files returned.
Probably declared as parameter in
caller to dimension output arrays
OUTPUTS:
BListAll integer actual number of files returned
cFile(*)*(*) character fully-qualified file names
TFile(*) real times for all files
XCFileBeg(*) real start Carrington variable for all files
XCFileEnd(*) real end Carrington variables for all files
WFile(*) real weights assigned to each file
Nr(*) real version number for each file
R0 real source surface distance in AU
Scale real conversion factor to be multiplied into
fnc values read by BReadFnc
CALLS: ***
ArrR4Copy, BadR4, FileSelection, IndexR4, SAYTOOSMALL, Say, cXCvarFormat, iSearch
CALLED BY:
MapReadSingle, MapReadTimes
INCLUDE:
include 'dirspec.h'
include 'filparts.h'
EXPLICIT:
integer BListFnc
EXTERNAL:
external BListFnc
RESTRICTIONS:
The test for version numbers of files (higher version numbers are supposed
to replace lower version numbers) is less than perfect.
It is based on the assumption that the start longitude and end longitude
does not change with version numbers. A previous version tested for the
time associated with each file, but this does change with version number
for the WSO_NOAA files.
MODIFICATION HISTORY:
MAY-2002, Paul Hick (UCSD/CASS)
SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Changed test for newer version numbers from a test on file times
to a test on start longitude. This makes more sense since for the
WSO files the start longitude is coded into the file name. For the
WSO_NOAA files it is actually the end longitude, but since there
is exactly one rotation in each file that amounts to the same thing.
[Previous]
[Next]
NAME:
bLOSCheckLoc
PURPOSE:
CATEGORY:
I/O
CALLING SEQUENCE:
logical function bLOSCheckLoc(XCbeg,XCend,NLOS,NINSIDE,DLOS,iYr,Doy,rLngLOS,rLatLOS,ObsXC,rLngSun,rDisSun)
INPUTS:
XCbeg real modified Carrington variable for start of map
XCend real modified Carrington variable for end of map
NLOS integer # segments along line of sight
(if NLOS=0 then bLOSCheckLoc always returns .TRUE.)
NINSIDE integer when at least NINSIDE segments lie inside [XCbeg, XCend]
the return value is .TRUE.
DLOS real length of los segment (what units??)
iYr integer year of observation
Doy real day of year (incl. fraction for time of day)
rLngLOS real Topocentric ecliptic longitude diff. with Earth-Sun line
rLatLOS real Topocentric ecliptic latitude
ObsXC real Modified Carrington variable for observer
rLngSun real Ecliptic longitude Sun
rDisSun real Sun-Earth distance (AU)
OUTPUTS:
bLOSCheckLoc logical
CALLED BY:
ReadVIPS, ReadVIPSLOSCheck, ReadVIPSLOSCheckn, ReadVIPSn
RESTRICTIONS:
CALLS: ***
ECLIPTIC_HELIOGRAPHIC, POINT_ON_LOS, XMAP_OBS_POS
PROCEDURE:
MODIFICATION HISTORY:
JUN-1994, Paul Hick (UCSD)
[Previous]
[Next]
NAME:
bOpenFile
PURPOSE:
Opens a file or checks for its existence.
By default, the user will be prompted to enter a filename until a file is
successfully opened. This behaviour can be modified in several ways using
options listed under the input argument 'Act' below.
CATEGORY:
I/O: opening files
CALLING SEQUENCE:
logical function bOpenFile(Act,iU,cFile,iRecl)
INPUTS:
More information may be available in the include openfile.h
Act integer sum of parameters defined in include file openfile.h
(the safest way to combine options is to use the .or. operator
e.g. OPN__NOMESSAGE .or. OPN__TRYINPUT)
OPN__NOMESSAGE suppress informational messages to screen
(error messages are always displayed)
OPN__TRYINPUT Skip first prompt and try input file name instead
Default: prompt for file name
OPN__SEARCHONLY Search only (i.e. check for existence)
Default: open file
OPN__ONEPASS Do not activate prompt loop on failure
Default: keep prompting until success
Used only if OPN__ONEPASS is set:
OPN__STOP On failure, STOP execution
Default: RETURN with .FALSE. return value
The following are only useful for opening files (OPN__SEARCHONLY not set)
OPN__NOPARSE Used only in combination with OPN__TRYINPUT:
Useful for bypassing a call to iSearch which may intervene
with a wildcard search. The iSearch call is responsible for
returning a fully qualified filename in cFile. OPN__NOPARSE
should be used only if the input value already is fully qualified
(e.g. output from another iSearch call).
OPN__SEQUENTIAL Open for sequential access
Default: direct access
OPN__FORMATTED Open for formatted read
Default: unformatted read
OPN__TRYALL Try all seq/direct, form/unform
Default: use OPN__SEQUENTIAL and OPN__FORMATTED
OPN__READONLY Open for read only
Default: open for read/write
(g77 does not support read-only files, so this
value is ignored on Linux)
OPN__RECLBYTE Is set to indicate that the record length iRecl is specified
in bytes, rather than 4-byte longwords.
By default bOpenFile tries to open an existing file and aborts if the file
does not exist. Modify this by one of the following three values:
OPN__APPEND Opens an existing file for append and aborts if the
file does not exist
OPN__NEW Opens a new file and aborts if it already exists
OPN__UNKNOWN Opens a file whether it exists or not.
Special definitions:
OPN__REOPEN = OPN__TRYINPUT+OPN__ONEPASS+OPN__NOPARSE
Useful for reopening a file known to exist:
the input value cFile is tried only once without parsing.
OPN__BINARY Same as OPN__SEQUENTIAL:
opens a sequential access, unformatted file, i.e.
a generic binary file.
OPN__TEXT Same as OPN__SEQUENTIAL+OPN__FORMATTED
opens a generic ascii file.
OPN__HOS Open Helios file.
Some trickery is required to determine the record length
of a Helios file on DOS/WIN or Unix. Use this parameter to
to identify an existing file as a Helios data file.
Helios files are always opened for direct, unformatted access.
cFile character*(*) File to be opened
(used only if OPN__TRYINPUT is set)
iRecl Record length in 4-byte longwords (unless option OPN__RECLBYTE is used).
On Linux and WIN record length only need to specified when opening
a file for direct access.
OUTPUTS:
bOpenFile
logical = .FALSE : if open/check failed or was aborted by user
= .TRUE. : if open/check succesful
Act integer (only if OPN__TRYALL was set)
mode used to open file, i.e. bits for OPN__SEQUENTIAL and/or
OPN__FORMATTED are set
iU integer On Failure: set to FIL__NOUNIT
On Success: Logical unit number of open file (open)
or FIL__NOUNIT+1 (check only)
cFile character*(*) On Failure: input value is retained
On Success: Fully qualified file name of opened/existing file
If the input file was a gzipped (.gz) file and the file was
` unzipped successfully, then the file of the unzipped file created
by iOSgunzip is returned. To get rid of the temporary file
closed the logical unit with iFreeLun.
iRecl On Failure: input value is retained
On Success: record length in 4-byte longwords
CALLED BY:
Average, BList_NSO_NOAA, BList_WSO_NOAA, BRead_WSO, Connect, DailyIPS_UCSD [1]
DailyIPS_UCSD [2], ExpandSW, ExtractInsitu, GIPSCAST, GIPSIMP, HERDISK, HOSRead
HOSUpdate, HOSWrite, HOSdos2vms, NODAT, OGetRecord, OpenTest, Pandora, Pandora_Records
ReadG, ReadVIPS, ReadVIPSLOSCheck, ReadVIPSLOSCheckn, ReadVIPSn, SD_TREE, SortIPS
TheFit, Time2smei_eph, WR2DARR, WriteI4GRD, WriteLOSD, WriteLOSY, WriteR4GRD, bReadNic
bWriteNic, dailyips [1], dailyips [2], iFltArr, iHOSInfo, iReadG, ice_read, ice_write
jpl_close, jpl_init, jpl_state, smei_base, smei_cal, smei_cal_c3mask, smei_cal_group
smei_cal_write, smei_frm_getlist, smei_frm_path, smei_orbit_info2, smei_skyd
sprint
INCLUDE:
include 'filparts.h'
include 'dirspec.h'
include 'openfile.h'
CALLS: ***
AskChar, Say, bHOSName, iGetFileSpec, iGetSymbol [1], iGetSymbol [2], iOSgunzip
iOpenFile, iPutFileSpec, iScratchLun, iSearch, iSetFileSpec, iSetSymbol [1]
iSetSymbol [2], itrim, uppercase
RESTRICTIONS:
iOpenFile is a system dependent function. Currently versions are available for
VMS, NT, Unix and Linux
SIDE EFFECT:
On success the output filename cFile is parsed using iSetFileSpec
PROCEDURE:
> The function iOpenFile called by this subroutine contains the actual open statements.
Separate versions of this function exists for every operating system.
> iOpenFile tries to determine the record length of the file. If unsuccessful,
the input value of iRecl is used.
On DOS and UNIX iOpenFile can only determine the record length for HELIOS data files.
> Act is a read-only variable, UNLESS all access methods are to be tried
(OPN__TRYALL used). In this case the OPN__TRYALL bit is cleared and the
the OPN__SEQUENTIAL and OPN__FORMATTED bits are set to the values used to open the file
The other bits are unchanged
> The existence check is performed by iSearch.
> A default for the file prompt is read from the symbol DEF_FILE (on VMS a global symbol).
> The file prompt allows for changing file name components separately, e.g
typing '.dat' will only change the extension of the default file name while keeping
all the other components.
> For HELIOS data file with standard file names (e.g. A76V4_007.DAT), the following
additional abbreviated responses are possible:
.ZLD results in cFile = 'A76V4_007.ZLD'
_111 results in cFile = 'A76V4_111.DAT'
_111.ZLD results in cFile = 'A76V4_111.ZLD'
9 results in cFile = 'A76V9_007.DAT'
MODIFICATION HISTORY:
NOV-1990, Paul Hick (UCSD/CASS)
SEP-1998, Paul Hick (UCSD/CASS)
Complete overhaul and merged with bOpenHOS
JUL-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Changed exit error code (set by Say) on open error from 'S'
(=1) to 'E' (=2)
JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Introduced use of cHideLogical (implicit through '#' prefix in Say call).
[Previous]
[Next]
NAME:
bOSFind
PURPOSE:
CALLING SEQUENCE:
logical function bOSFind(iNewSearch,cBufIn,iType,cName)
CALLED BY:
iSearch
INCLUDE:
include 'dirspec.h'
include 'filparts.h'
include 'str2str_inc.h'
CALLS: ***
LocFirst, LocLast, Str2StrSet, iFreeLun, iGetLun, iOSDeleteFile, iOSSpawnCmd
iScratchLun, iUniqueName, itrim
PROCEDURE:
Specify full path including directory and file name.
Wildcards only permitted in the file name part. (use output of bValidPath)
In DOS to test for the root directory set e.g. cBufIn=A: (no trailing \).
??? What really happens when cBufIn=A: ??.
The file name is returned in cName.
Note that the scratch file used to as a destination for the ouput of the
dir command remains open, and hence that the associated logical unit
remains assigned.
Somewhere there is a version of bOSFind for DOS which uses the DOS
interrupt function instead of the SYSTEM function. This version was written to
for use with Windows programs.
MODIFICATION HISTORY:
DEC-1995, Paul Hick (UCSD/CASS)
JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added imperfect patch to allow iSearch to work partially with
directories with lots of files in.
[Previous]
[Next]
NAME:
bOSFindClose
CALLS: ***
LocFirst, LocLast, Str2StrSet, iFreeLun, iGetLun, iOSDeleteFile, iOSSpawnCmd
iScratchLun, iUniqueName, itrim
CALLED BY:
jpl_close, jpl_init, jpl_state, smei_foreign, smei_frm_getfirst, smei_frm_getnext
[Previous]
[Next]
NAME:
BRead_NSO_NOAA
PURPOSE:
Read file with synoptic map data for the magnetic field at a
source surface into a 2D array
This routine applies to the WSO files we download from NOAA (courtesy
of Nick Arge).
CALLING SEQUENCE:
integer function BRead_NSO_NOAA(cFile, nMax, ZFile, nLng, nLat)
INPUTS:
cFile*(*) character fully-qualified name of source surface file
nMax integer Max. # allowed grid points in synoptic map
OUTPUTS:
BRead_NSO_NOAA integer return status (0=Failure,1=Success)
ZFile(nLng,nLat) real 2D synoptic map with radial magnetic field
nLng integer # grid longitudes
nLat integer # grid latitudes
CALLS: ***
BRead_WSO
CALLED BY:
BField_Choose, BField_Get
SEE ALSO:
BListAll, BList_WSO_NOAA, BRead_WSO, MapReadSingle, MapReadTimes
EXTERNAL BY:
BField_Get
PROCEDURE:
One-line interface to BRead_WSO.
The NOAA NSO files have exactly the same structure as the regular WSO
files, so we can use the same reader.
MODIFICATION HISTORY:
JUL-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
JUN-2003, Tamsen Dunn (UCSD/CASS); based on BRead_WSO_NOAA
[Previous]
[Next]
NAME:
BRead_WSO
PURPOSE:
Read file with synoptic map data for the magnetic field at a
source surface (in muT) into a 2D array
This routine applies to the regular WSO files downloaded from
the WSO web site.
CALLING SEQUENCE:
integer function BRead_WSO(cFile, nMax, ZFile, nLng, nLat)
INPUTS:
cFile*(*) character fully-qualified name of source surface file
nMax integer Max. # allowed grid points in synoptic map
OUTPUTS:
BRead_WSO integer return status (0=Failure,1=Success)
ZFile(nLng,nLat) real 2D synoptic map with radial magnetic field
in muT (micro Tesla)
nLng integer # grid longitudes
nLat integer # grid latitudes
CALLED BY:
BField_Choose, BField_Get, BRead_NSO_NOAA, BRead_WSO_NOAA, Peep
EXTERNAL BY:
BField_Get
INCLUDE:
include 'openfile.h'
include 'filparts.h'
include 'ftspar.h'
CALLS: ***
ArrR4Bad, ArrR4Copy, ArrR4Reverse, ArrR4Step, FTCLOS, FTGISZ, FTGKYJ, FTGPVE, FTNOPN, Say
Str2Flt, asind, bOpenFile, iFreeLun, iGetFileSpec, iGetLun, iOSDeleteFile, iOSgunzip
iSetFileSpec, itrim, nrInterpol, say_fts
SEE ALSO:
BListAll, BList_WSO, BRead_WSO_NOAA, MapReadSingle, MapReadTimes
PROCEDURE:
> The BRead* functions are called as external functions by MapReadSingle
and MapReadTimes.
> The magnetic source surfaces files contain the radial component of
the magnetic field at some source surface. Currently they come in
two flavors:
- containing 73x29 arrays at a 5 deg resolution covering 360 degree
in longitude and [-70,70] in latitude, or
- containing 73x30 arrays at a 5 deg resolution in longitude covering
360 degree, and covering -14.5/15 to +14.5/15 in 30 equal steps in
sine latitude.
> The array ZFile(nLng,nLat) is assumed to refer to a single rotation
covering 360 degrees in longitude, and [-90,+90] in latitude).
The part of the array above and below the latitudes available in the
file are flagged as 'bad'.
> The start longitude (i.e. the heliographic longitude of column
Z[nLng,*) is determined from the file name by function BList_WSO.
MODIFICATION HISTORY:
JUL-1993, Paul Hick (UCSD/CASS)
JUL-2001, Paul Hick (UCSD/CASS)
Removed a redundant call to iGetLun
MAY-2002, Paul Hick (UCSD/CASS)
Revamped to work with the tomography program.
Support for GRPACK has been dropped.
JUL-2002, Tamsen Dunn (UCSD/CASS)
Check for empty record at end of file added.
AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Bug fix. For incomplete files the missing columns were not
explicitly flagged as bad, so they contained garbage.
DEC-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added reading of FITS files (as created by IDL routine
wso_write.pro).
[Previous]
[Next]
NAME:
BRead_WSO_NOAA
PURPOSE:
Read file with synoptic map data for the magnetic field at a
source surface into a 2D array
This routine applies to the WSO files we download from NOAA (courtesy
of Nick Arge).
CALLING SEQUENCE:
integer function BRead_WSO_NOAA(cFile, nMax, ZFile,nLng,nLat)
INPUTS:
cFile*(*) character fully-qualified name of source surface file
nMax integer Max. # allowed grid points in synoptic map
OUTPUTS:
BRead_WSO_NOAA integer return status (0=Failure,1=Success)
ZFile(nLng,nLat) real 2D synoptic map with radial magnetic field
nLng integer # grid longitudes
nLat integer # grid latitudes
CALLS: ***
BRead_WSO
CALLED BY:
BField_Choose, BField_Get
SEE ALSO:
BListAll, BList_WSO_NOAA, BRead_WSO, MapReadSingle, MapReadTimes
EXTERNAL BY:
BField_Get
PROCEDURE:
One-line interface to BRead_WSO.
The NOAA WSO files have exactly the same structure as the regular WSO files,
so we can use the same reader.
MODIFICATION HISTORY:
JUL-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bReadNic
PURPOSE:
Read image from prototype SMEI camera
CATEGORY:
I/O
CALLING SEQUENCE:
logical function bReadNic(iAct0, cFile, N, nX, nY, nB, Img, cTrailer)
INPUTS:
iAct0 integer open code passed to bOpenFile
Usually set to zero. If cFile is known
to exist (e.g. a return value from
iSearch) then file access can be
made more efficient by using the value
OPN__REOPEN (defined in openfile.h).
cFile character*(*) file name
N integer size of Img
OUTPUTS:
bReadNic logical .TRUE. : success
.FALSE.: failure
nX integer horizontal size of image
nY integer vertical size of image
nB integer # bytes per number on input file
2 for integer*2
4 for integer*4
-4 for real*4
Img(nX*nY) real image data
cTrailer character*(*) trailer info from image file
CALLS: ***
Say, bOpenFile, iFreeLun
CALLED BY:
Peep, bCompressNic, smei_frm_read, smei_frm_read_get_sdark
SEE ALSO:
bWriteNic
RESTRICTIONS:
Reading of *.nic.gz files depends on availability of gzip
(windows) or gunzip (Linux).
SIDE EFFECTS:
Linux : bOpenFile is passed OPN__RECLBYTE+OPN__READONLY
Other OS: bOpenFile is passed OPN__BINARY +OPN__READONLY
INCLUDE:
include 'openfile.h'
include 'dirspec.h'
PROCEDURE:
On Linux the file is opened as a direct, unformatted file with
a record length of 2 bytes. The file is read in packets of 2 byte.
This also works on Windows, but a much faster method opens
the file as a sequential, unformatted file and, after reading the
the array dimensions from the header reads the entire image with
a single read (this does not work on Linux).
MODIFICATION HISTORY:
AUG-2000, Paul Hick (UCSD/CASS)
MAR-2003, Paul Hick (UCSD/CASS)
Added capability to process *.nic.gz files (the file is
decompressed into a temporary file in $temp; the temporary
file is read and deleted).
JUL-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added argument nB.
Modified to enable reading of integer*4 and real*4 data.
The output now is real*4 instead of integer*4.
[Previous]
[Next]
NAME:
bStr2Dbl
CALLING SEQUENCE:
logical function bStr2Dbl(cStr,N,R)
CALLED BY:
AskR8
PROCEDURE:
bStr2Dbl is a special case of a Str2Dbl call.
CALLS: ***
Str2Dbl, Str2Flt_Crumbs, Str2Flt_Exp
SEE ALSO:
Str2Dbl
MODIFICATION HISTORY:
DEC-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bStr2Flt
CALLING SEQUENCE:
logical function bStr2Flt(CStr,N,R)
CALLED BY:
AskR4
PROCEDURE:
bStr2Flt is a special case of a Str2Flt call.
CALLS: ***
Str2Flt, Str2Flt_Crumbs, Str2Flt_Exp
SEE ALSO:
Str2Flt
MODIFICATION HISTORY:
DEC-1992, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bTempFile
PURPOSE:
Rename an existing file giving it a unique file name
CATEGORY:
File system
CALLING SEQUENCE:
logical function bTempFile(cFile,cTmpFile)
INPUTS:
cFile character*(*) file to be renamed
OUTPUTS:
cTmpFile character*(*) fully-qualified, new, unique file name
CALLS: ***
Say, iFilePath, iGetFileSpec, iGetLogical [1], iGetLogical [2], iOSRenameFile
iSetFileSpec, iUniqueName
CALLED BY:
Pandora_Records
INCLUDE:
include 'dirspec.h'
include 'filparts.h'
PROCEDURE:
> The specified file is moved to directory $temp and is given a unique name
DEPENDENCY TREE:
(FORSTR.F LOGMODFILE.F OSCALLS.F)
iSetFileSpec
iGetFileSpec
iPutFileSpec
iFilePath
(see above)
iUniqueName
(see above)
iGetLogical
itrim
LogModFile
itrim
bGetLun
iGetLun
iFreeLun
iOSRenameFile *(system call)
iOSDeleteFile *(system call)
iOSRenameFile *(system call)
iGetDefaultDir ?
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
BuildSourceSurface
PURPOSE:
Construct a new density/velocity map from line of sight values and weights based
on the ratio or difference of observed to model values for each line of sight.
CATEGORY:
Tomography
CALLING SEQUENCE:
subroutine BuildSourceSurface(I__VD,bRemove,bBound,BINXmin,NBAD,FIX,FIXMEAN,FIXSTDV,
& PPprj,Weight,XCbegMAT,XCendMAT,ZMAP,SIGB,Tmp1,Tmp2,BINX,BIN)
INPUTS:
I__VD integer = TOM__V: new V map
= TOM__G: new G^2 map
bRemove logical activates sigma cut-off if .TRUE.
bBound logical
BINXmin real min. # los crossings required for deconvolution
NBAD(NL) integer flag for bad lines of sight data (0-bad,1-good)
FIX (NL) real ratio observed/model los observation (from LOSTweak)
FIXMEAN real
FIXSTDV real
PPprj (3,NLOS,NL) real Lng/lat/time of los segment on source surface
Weight(NLOS,NL) real Weights of los segments (from LOSIntegralV or LOSIntegralG)
XCbegMAT(nTim)
XCendMAT(nTim)
ZMAP(nLng,nLat,nTim) real Velocity or g^2 map
(the input map is assumed to have no holes)
SIGB real sigma cut-off (applied to SIG)
bBound logical limit the D-map to its boundaries?
Tmp1(nLng,nLat,nTim) real scratch array
Tmp2(nLng,nLat,nTim) real scratch array
BIN (PRJ__N,NLOS,NL) integer scratch array
OUTPUTS:
ZMAP(nLng,nLat,nTim) real new map; holes in the map are indicated by BadR4()
NBAD(NL) integer (Updated only if NS=1)
flag for bad line of sight data (0-bad,1-good)
BINX(nLng,nLat,nTim) real # projected los segments in each bin at the source surface
Not used anywhere as yet:
BIN (PRJ__N,NLOS,NL) integer longitude index of source surface map bin where segment was projected
(NOMOD only: will be zero if segment projected outside map)
integer latitude index of bin where segment was projected
integer time index of bin where segment was projected
CALLS: ***
ArrR4Total, ArrR4Zero, BadR4, FLINT, Flt2Str, Int2Str, Say, Str2Str, T3D_get_grid
T3D_iget, iArrR4ValuePresent
CALLED BY:
ipsg2, ipsg2s, ipsg2t
INCLUDE:
include 't3d_param.h'
include 't3d_array.h'
include 't3d_index.h'
include 't3d_grid_fnc.h'
include 't3d_loc_fnc.h'
RESTRICTIONS:
There should be no holes (BadR4()) values in the input array ZMAP
PROCEDURE:
MODE = iand(MODE,TOM__DIFF) = 0: corrections based on ratios
= iand(MODE,TOM__DIFF) > 0: corrections based on differences
= iand(MODE,TOM__MOD ) = 0: no remapping
= iand(MODE,TOM__MOD ) > 0: remap XC using mod(XCend-XCbeg)
iand(MODE,TOM__MOD)
> 0: segments with XCprj values outside [XCbeg,XCend] are mapped back into this range
= 0: segments with XCprj values outside [XCbeg,XCend] are ignored
MODIFICATION HISTORY:
NOV-1995, B. Jackson (STEL,UCSD)
MAY-1999, Paul Hick (UCSD/CASS); extensive revisions
AUG-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu); modified for time-dependent tomography
[Previous]
[Next]
NAME:
bUncompressNic
PURPOSE:
Read compressed *.nic file, and decompress it to *.nic file
CATEGORY:
I/O
CALLING SEQUENCE:
logical function bUncompressNic(iAct, cFile, cDir)
INPUTS:
iAct integer open specified (passed to bOpenFile)
If cFile is known to be a valid *.ice file use
iAct = OPN__TRYINPUT
cFile character*(*) file name (with .ice file type)
cDir character*(*) output directory;
if cDir = ' ' then the decompressed file
is put in the same directory as the input file
OUTPUTS:
bUncompressNic logical .TRUE. : file decompressed successfully
.FALSE.: error decompressing file
(decompressed file)
CALLS: ***
Int2Str, bWriteNic, ice_read, itrim
CALLED BY:
rice
INCLUDE:
include 'dirspec.h'
include 'openfile.h'
include 'filparts.h'
RESTRICTIONS:
Writing the decompressed file will currently only work on Windows.
PROCEDURE:
> If cDir = ' ', then the decompressed file is written into the same directory
as the original image file.
> The file name of the compressed file is the same as the original file
with the file type changed to .nic.
> The decompressed file should be byte for byte identical to the original file (i.e. the
DOS 'fc /b' command or the Unix 'diff' command should not detect any differences.
MODIFICATION HISTORY:
DEC-2000, Kevin Nguyen, Paul Hick (UCSD; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bValidFileName
PURPOSE:
CALLING SEQUENCE:
logical function bValidFileName(iType,cFile)
CALLS: ***
uppercase
CALLED BY:
bValidFragment, bValidPath
INCLUDE:
include 'dirspec.h'
PROCEDURE:
Based on DOS5.0 User's Guide and Reference.
For file names: Chapter 4, p. 69
For directory names : Chapter 5, p. 102
The difference in testing for file and directory names are:
1.) The 3 characters @ ' ` are not permitted in directories
2.) Directory names are at least 1 char long; file names
can have zero length.
3.) File name and extension can't have zero-length at the same time
MODIFICATION HISTORY:
DEC-1995, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bValidFragment
PURPOSE:
CALLING SEQUENCE:
logical function bValidFragment(iType,isub,cFileSub,iBuf,cBuf)
CALLS: ***
LocLast, bValidFileName
CALLED BY:
bValidPath
INCLUDE:
include 'dirspec.h'
MODIFICATION HISTORY:
DEC-1995, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bValidPath
PURPOSE:
Build a valid fully-qualified file name for Unix or DOS
CALLING SEQUENCE:
logical function bValidPath(cFile,cDir,cName)
INPUTS:
iType integer 0 = test for file name
1 = test for directory name
cFile character*(*) string to be tested for validity
OUTPUTS:
Result logical .FALSE. = invalid file/directory name
.TRUE. = valid file/directory name
cDrive character*(*) 2-char drive spec ('C:') (DOS-only)
cBuf character*(*) parsed version of input spec (including
drive, directory and file name)
CALLED BY:
iSearch
INCLUDE:
include 'dirspec.h'
CALLS: ***
GETCWD, bValidFileName, bValidFragment, itrim
RESTRICTIONS:
DOS:
Extended chars are permitted in principle. This is not implemented here.
PROCEDURE:
Tests a full spec consisting of drive, directory and filename.
Valid full directory names are e.g. (the C: is optional):
C: ???? excluded
C:\
C:\sub1
C:\sub1\ ???? excluded
i.e. any string that, after terminating it with \ if necessary,
can be combined with a file name to produce a valid path to the file
name.
Note that this definition makes the interpretation of C: ambiguous:
C:file.ext is a file in the current directory on the C: drive.
But if first the terminating backslash is appended the meaning changes:
C:\file.ext is a file in the root directory on the C: drive.
A valid full filename is tested by validating the part preceding the last
backslash as a valid directory name, and validating the remaining part
as a file name. Valid full filenames are: (the C: is optional)
C:file.ext
C:\file.ext
C:\sub\file.ext
MODIFICATION HISTORY:
DEC-1995, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bWriteFrm
PURPOSE:
Writes a binary .nic file in the exact format the SMEI camera
software produces.
CATEGORY:
I/O
CALLING SEQUENCE:
logical function bWriteFrm(cFile, cDir, nX, nY, nB, Orig, hdr)
INPUTS:
cFile character*(*) file name
(the file type will be replaced by .nic)
cDir character*(*) output directory
if not left blank this directory overrides
the directory specification in cFile
nX integer row length
nY integer column height
nB integer # bytes per number in output file
2 for integer*2
4 for integer*4
-4 for real*4
Orig(nX*nY) integer image data
hdr(*) double precision
frame header entries
OUTPUTS:
(output to .nic file)
CALLS: ***
NicHdr, bWriteNic
CALLED BY:
smei_cal
SEE ALSO:
bReadNic
PROCEDURE:
See bWriteNic
MODIFICATION HISTORY:
JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
bWriteNic
PURPOSE:
Writes a binary .nic file in the exact format the SMEI camera
software produces.
CATEGORY:
I/O
CALLING SEQUENCE:
logical function bWriteNic(cFile, cDir, nX, nY, nB, Orig, cTrailer)
INPUTS:
cFile character*(*) file name
(the file type will be replaced by .nic)
cDir character*(*) output directory
if not left blank this directory overrides
the directory specification in cFile
nX integer row length
nY integer column height
nB integer # bytes per number in output file
2 for integer*2
4 for integer*4
-4 for real*4
Orig(nX*nY) integer image data
cTrailer character*512 trailer
OUTPUTS:
(output to .nic file)
CALLS: ***
bOpenFile, iFreeLun, iGetFileSpec, iPutFileSpec, iSetFileSpec, itrim
CALLED BY:
bUncompressNic, bWriteFrm
SEE ALSO:
bReadNic
INCLUDE:
include 'dirspec.h'
include 'filparts.h'
include 'openfile.h'
RESTRICTIONS:
Has only been tested on NT and Linux
PROCEDURE:
WIN: Output file is opened as a sequential access file
(iAct = OPN__REOPEN+OPN__NEW+OPN__BINARY in bOpenFile call)
The file is written with a single write:
read (iU) ....
Linux: The WIN method produces a file in Linux which has 8 bytes
attached to the end. To avoid this we open a direct access file
(iAct = OPN__REOPEN+OPN__NEW+OPN__RECLBYTE in bOpenFile call)
with a record length in bytes equal to the total size of the file
The file is written with a single write:
read (iU,rec=1) ....
The second method (for Linux) will also work for WIN.
MODIFICATION HISTORY:
FEB-2001, Paul Hick (UCSD/CASS)
JUL-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Modified to enable reading of integer*4 and real*4 data.
The input array is now real*4 instead of integer*4.