[Previous]
[Next]
NAME:
WhatIsI4
PURPOSE:
Write information about integer*4 array
CALLING SEQUENCE:
subroutine WhatIsI4(N,A,cStr)
INPUTS:
N integer # elements in array A
A(N) integer array
cStr*(*) character*(*) message
OUTPUTS:
(to screen)
CALLS: ***
ArrI4GetMinMax, BadI4, iArrI4ValuePresent, itrim
MODIFICATION HISTORY:
AUG-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
WhatIsI8
PURPOSE:
Write information about integer*8 array
CALLING SEQUENCE:
subroutine WhatIsI8(N,A,cStr)
INPUTS:
N integer # elements in array A
A(N) integer*8 array
cStr*(*) character*(*) message
OUTPUTS:
(to screen)
CALLS: ***
ArrI8GetMinMax, BadI8, iArrI8ValuePresent, itrim
MODIFICATION HISTORY:
JAN-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
WhatIsR4
PURPOSE:
Write information about real*4 array
CALLING SEQUENCE:
subroutine WhatIsR4(N,A,cStr)
INPUTS:
N integer # elements in array A
A(N) real array
cStr*(*) character*(*) message
OUTPUTS:
(to screen)
CALLS: ***
ArrR4GetMinMax, BadR4, iArrR4ValuePresent, itrim
CALLED BY:
smei_cal
MODIFICATION HISTORY:
AUG-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
WR2DARR
PURPOSE:
Write 2D array to file
CALLING SEQUENCE:
subroutine WR2DARR(ID,nX,nY,Z,cFile,cFrmt,bMirror,iStr,cStr)
INPUTS:
ID integer 1: write to new file
0: append to existing file
(adding 2 suppresses messages to screen)
nX integer size of first dimension
nY integer size of second dimension
Z(nX,nY) real array to be written to file
cFile character*(*) name of output file
cFmt character format to be used for output
bMirror logical (see PROCEDURE)
iStr integer # comment strings
cStr(iStr)*(*) character*(*) comments strings (see PROCEDURE)
OUTPUTS:
Z(nX,nY) real the input array will be modified if
values are present that do not fit the
input format: these will be set to BadR4()
Output file cFile is created
CALLED BY:
ExpandSW, T3D_write_bb, T3D_write_nv, Write3D_nv_XC, iWriteProxyMapN, ipsd
INCLUDE:
include 'filparts.h'
include 'dirspec.h'
include 'openfile.h'
CALLS: ***
ArrR4GetMinMax, ArrR4Mask, BadI4, BadR4, LocFirst, LocFirstLen, Say, Str2Flt, bOpenFile
cFlt2Str, cTime2System, iArrR4ValuePresent, iFreeLun, itrim, uppercase
RESTRICTIONS:
> !!!! Numbers in the input array that do not fit the format
!!!! WILL BE SET TO BadR4()
> iStr must be >= 1
PROCEDURE:
> The array is checked for values BadI4() (I format) or BadR4() (E,F format).
For I format 'bad' elements are replaced by the biggest negative integer
that fits the format, with the restriction that the number is not smaller
than BadI4() (=the biggest negative 32-bit integer).
For F format 'bad' elements are replaced by the bigges negative real*4 number
that fits the format, with the restriction that there are no more than 7 leading
digits of 9 (it the format contains more digits these are set to zero).
> If bMirror = .FALSE. then Z will be output row after row (I=1,NX).
If bMirror = .TRUE. then Z will be output column after column (I=1,NY).
> If the format specifier is an integer format, the floating point array
Z will be output using the NINT function.
> If the format specifier cFmt does not contain a repeat counter than
nX is used (or nY if bMirror=.TRUE.). If a repeat counter
is used, it should be <= than nX (or nY).
> If a repeat counter N is used each row (or column) will be split over
multiple records with N numbers per record. The last record output for
a row (or column) will contain less numbers than N if N is not a
factor of nX (or nY).
> The iStr comment strings are written to the beginning of the file
with a semi-colon (;) prepended. Empty strings (itrim()=0) are skipped.
> A new file (ID > 0) will be started with one or two comment strings (preceded
by a semi-colon). The first contains the file name retured by bOpenFile (this
should be a fully-qualified file name) and the time and date when the file
was created. The second line contains the value used to replace BadR4() values
in the output file. This line looks like e.g.
; Bad value flag: -9999.99
> The output file is created as a sequential acces, formatted file.
MODIFICATION HISTORY:
DEC-1995, Paul Hick (UCSD/CASS)
???-2000, Paul Hick (UCSD/CASS)
added option to suppress messages to screen by adding 2 to ID.
SEP-2001, Paul Hick (UCSD/CASS)
added output of more extensive message to screen when values in the input
array do not fit the specified format. This message is never suppressed.
Also modified the declaration of string cStr from cStr(iStr)*(*) to
cStr(*)*(*), removing the restriction iStr >=1.
MAY-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Fixed minor bug: the test for values that do not fit the output format
cFmt, sometimes generated a unnecessary warning message.
[Previous]
[Next]
NAME:
Write3D_bb
PURPOSE:
Write magnetic field output to bb3d* file
CATEGORY:
I/O
CALLING SEQUENCE:
subroutine Write3D_bb(XC3D,V3D,BR3D,BT3D,BN3D)
INPUTS:
cWild character wild card specification for locating magnetic field
files in the format processed by FileSelection.
V3D (nLng,nLat,nRad) real 3D velocity array
(contains bad values)
XC3D(nLng,nLat,nRad) real shift from source surface (in Carrington variable)
(does not contain any bad values)
(additional inputs, such as the dimensions nLng,nLat,nRad are pulled
out of the internal t3d array)
OUTPUTS:
BR3D(nLng,nLat,nRad) real scratch array (content does not matter)
BT3D(nLng,nLat,nRad) real scratch array (content does not matter)
BN3D(nLng,nLat,nRad) real scratch array (content does not matter)
(these magnetic field components are also written to file)
CALLED BY:
ipsd, ipsg2s, ipsg2t
RESTRICTIONS:
nRad must be larger/equal 3. (??? Why ???)
CALLS: ***
ArrR4Bad, ArrR4TimesConstant, BField_Get, BadR4, FLINT, T3D_get, T3D_get_grid, T3D_set
T3D_write_bb, cosd
INCLUDE:
include 'sun.h'
include 't3d_array.h'
include 'b3d_param.h'
include 't3d_grid_fnc.h'
PROCEDURE:
> The radial dependence of Br follows from flux conservation:
Br = BB*(RR/r)^2
> The tangential component follows from geometrical considerations
by assuming that the magnetic field lies along the Parker spiral:
(Omega is angular velocity of Sun):
Bt/Br = r*cos(Lat)*Omega/V
Bt = BB*(Omega*RR*cos(Lat)/V)*(RR/r)
> We use 'normalized' magnetic field components, which are as much as
possible independent of radial distance:
r^2*Br = RR^2*BB
r *Bt = RR^2*BB *Omega*cos(Lat)/V
Since we are mostly interested in magnetic field at Earth, we express
radial distances in units of r0 = 1 AU):
(r/r0)^2*Br = (RR/r0)^2*BB
(r/r0) *Bt = (RR/r0)^2*BB * r0*Omega*cos(Lat)/V
These are the quantities written to file and returned in the output
arrays. The magnetic units are nT (the same units are usually used
for insitu values at 1 AU).
> In terms of the quantities defined in include file sun.h:
r0*Omega/V = SUN__AU*10^13*SUN__OMEGA*10^-6/(V[km/s]*10^5)
= 100*SUN__AU*SUN__OMEGA/V[km/s]
> For each grid point XC3D is used to trace the point back to the source surface.
If both the velocity V3D and the radial magnetic field BR3D at the source
surface are valid then valid BR3D and BT3D in the grid point are returned.
The velocity needed for BT3D is taken as the average between the source
surface velocity and the velocity in the grid point (if it is valid).
> *TJD*'s unit reminders
X's output is in mT or 10^-2G. to bring to nT:
(15/215)^2 * (10^-6 T / mT) (10^9 nT/ T)
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
NOV-2001, Tamsen Dunn (UCSD/CASS; tdunn@ucsd.edu)
JUL-2002, Paul Hick (UCSD/CASS)
Valid magnetic fields are returned only in grid points where the
source surface Br and V are both valid. Previously Br would be valid
if only the source surface Br was valid (even if V was bad).
AUG-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added check for type of source surface data (WSO or WSO_NOAA maps)
AUG-2002, Tamsen Dunn (UCSD/CASS; tdunn@ucsd.edu)
Altered Bt component to depend entirely on V3D. If V3D doesnt exist, uses VV.
[Previous]
[Next]
NAME:
Write3D_bb_UT
PURPOSE:
Write magnetic field output to b3d* file
CATEGORY:
I/O
CALLING SEQUENCE:
subroutine Write3D_bb_UT(cWild,NT,nCar,JDCar,XCbegMAT,XCendMAT,XCbegROI,XCendROI,XC3D,VV3D,BR3D,BT3D,BN3D,BRSS,BTSS)
INPUTS:
cWild*(*) character wild card for locating magnetic field files
in the format processed by ForeignFile.
NT integer # times written to separate files
nCar integer
JDCar(nCar) real*8
XCbegMAT(nTim) real start Carrington variable of matrix (- NCoff)
XCendMAT(nTim) real end Carrington variable of matrix (- NCoff)
(range of matrix typically is three Carrington rotations)
XCbegROI(nTim) real start Carrington variable of region of interest
XCendROI(nTim) real end Carrington variable of region of interest
(the region of interest typically covers one whole
Carrington rotation
XC3D(3,nLng,nLat,nRad,nTim)
real shift from source surface (in Carrington variable)
Array should not have any bad values.
VV3D(nLng,nLat,nRad,nTim)
real 3D velocity array (may contain bad values, filled in
by e.g. Write3D_nv.
BR3D(nLng,nLat,nRad) real scratch array
BT3D(nLng,nLat,nRad) real scratch array
BN3D(nLng,nLat,nRad) real scratch array
BRSS(nLng,nLat,nTim) real scratch array to read Br
BTSS(nLng,nLat,nTim) real scratch array to read Bt (not used)
OUTPUTS:
(to file)
CALLED BY:
ipsg2s, ipsg2t
RESTRICTIONS:
> The VV3D array can have bad values in it. Usually this routine is called after
Write3D_nv has added bad values to the velocity array.
> nRad must be larger/equal 3.
CALLS: ***
ArrR4TimesConstant, BField_Get, BadR4, EARTH, FLINT, FLINT8, Julian, T3D_get_grid
T3D_iget, T3D_iset, T3D_set, T3D_write_bb, XMAP_SC_POS, cosd
INCLUDE:
include 'sun.h'
include 't3d_param.h'
include 't3d_array.h'
include 't3d_index.h'
include 't3d_grid_fnc.h'
include 't3d_loc_fnc.h'
EXTERNAL:
external EARTH
PROCEDURE:
The radial dependence of Br follows from flux conservation:
Br = BB*(RR/r)^2
The tangential component follows from geometrical considerations
by assuming that the magnetic field lies along the Parker spiral:
(Omega is angular velocity of Sun):
Bt/Br = r*cos(Lat)*Omega/V
Bt = BB*(Omega*RR*cos(Lat)/V)*(RR/r)
Output are 'normalized' magnetic field components (making the
values independent of radial distance):
r^2*Br = RR^2*BB
r *Bt = RR^2*BB *Omega*cos(Lat)/V
Expressing radial distances in units of r0 = 1 AU):
(r/r0)^2*Br = (RR/r0)^2*BB
(r/r0) *Bt = (RR/r0)^2*BB * r0*Omega*cos(Lat)/V
In terms of quantities defined in include file sun.h:
r0*Omega/V = SUN__AU*10^13*SUN__OMEGA*10^-6/(V[km/s]*10^5) = 100*SUN__AU*SUN__OMEGA/V[km/s]
The Stanford source surface maps at RR = 2.5 Rsun give the radial magnetic field BB in muT.
We are mostly interested in magnetic field at Earth, i.e. about r0=1 AU. We expect magnetic
fields of order (RR/r0)^2*BB ~ 10^-4*BB ~ 0.1 nT. This extra factor of 10^4 is included in the
output i.e. output is in units of 0.1 nT.
(In situ magnetic fields at Earth are typically in the nT range, at least one order of
magnitude larger than predicted from the Stanford maps, probably indicating that the Stanford
potential field maps underestimate the magnetic field near the current sheet by that much.)
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
Write3D_bb_XC
PURPOSE:
Write magnetic field output to b3d* file
CATEGORY:
I/O
CALLING SEQUENCE:
subroutine Write3D_bb_XC(cWild,XCbegMAT,XCendMAT,XCbegROI,XCendROI,XC3D,VV3D,BR3D,BT3D,BN3D,BRSS,BTSS)
INPUTS:
cWild*(*) character wild card for locating magnetic field files
in the format processed by ForeignFile.
XCbegMAT(nTim) real start Carrington variable of matrix (- NCoff)
XCendMAT(nTim) real end Carrington variable of matrix (- NCoff)
(range of matrix typically is three Carrington rotations)
XCbegROI(nTim) real start Carrington variable of region of interest
XCendROI(nTim) real end Carrington variable of region of interest
(the region of interest typically covers one whole
Carrington rotation
VV3D(nLng,nLat,nRad,nTim)
real 3D velocity array
XC3D(3,nLng,nLat,nRad,nTim)
real shift from source surface (in Carrington variable)
BR3D(nLng,nLat,nRad) real scratch array
BT3D(nLng,nLat,nRad) real scratch array
BN3D(nLng,nLat,nRad) real scratch array
BRSS(nLng,nLat,nTim) real scratch array to read Br
BTSS(nLng,nLat,nTim) real scratch array to read Bt (not used)
OUTPUTS:
(to file)
RESTRICTIONS:
nRad must be larger/equal 3.
CALLS: ***
ArrR4TimesConstant, BField_Get, BadR4, FLINT, Say, T3D_get_grid, T3D_iget, T3D_iset
T3D_set, T3D_write_bb, cosd
INCLUDE:
include 'sun.h'
include 't3d_param.h'
include 't3d_array.h'
include 't3d_index.h'
include 't3d_grid_fnc.h'
include 't3d_loc_fnc.h'
EXTERNAL:
PROCEDURE:
The radial dependence of Br follows from flux conservation:
Br = BB*(RR/r)^2
The tangential component follows from geometrical considerations
by assuming that the magnetic field lies along the Parker spiral:
(Omega is angular velocity of Sun):
Bt/Br = r*cos(Lat)*Omega/V
Bt = BB*(Omega*RR*cos(Lat)/V)*(RR/r)
Output are 'normalized' magnetic field components (making the
values independent of radial distance):
r^2*Br = RR^2*BB
r *Bt = RR^2*BB *Omega*cos(Lat)/V
Expressing radial distances in units of r0 = 1 AU):
(r/r0)^2*Br = (RR/r0)^2*BB
(r/r0) *Bt = (RR/r0)^2*BB * r0*Omega*cos(Lat)/V
In terms of quantities defined in include file sun.h:
r0*Omega/V = SUN__AU*10^13*SUN__OMEGA*10^-6/(V[km/s]*10^5) = 100*SUN__AU*SUN__OMEGA/V[km/s]
The Stanford source surface maps at RR = 2.5 Rsun give the radial magnetic field BB in muT.
We are mostly interested in magnetic field at Earth, i.e. about r0=1 AU. We expect magnetic
fields of order (RR/r0)^2*BB ~ 10^-4*BB ~ 0.1 nT. This extra factor of 10^4 is included in the
output i.e. output is in units of 0.1 nT.
(In situ magnetic fields at Earth are typically in the nT range, at least one order of
magnitude larger than predicted from the Stanford maps, probably indicating that the Stanford
potential field maps underestimate the magnetic field near the current sheet by that much.)
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
Write3D_bbtt
PURPOSE:
Write magnetic field output to bb3d* file
CATEGORY:
I/O
CALLING SEQUENCE:
subroutine Write3D_bbtt(XCbeGG,iT3D,nT3D, TT3D,XC3D,VV3D,BRss,BR3D,BT3D,BN3D)
INPUTS:
XCbeGG(2,nTim) real Somehow related to the tomography times
Only XCbeGG(1,1) and XCbeGG(2,1) are used
iT3D integer 1st time index in TT3D processed
TT3D(iT3D) must be a valid time.
(the last time index processed is determined
internally as the last valid time in TT3D)
nT3D integer size of time dimension in arrays
TT3D,XC3D,VV3D and BRss.
(essential to control access to array
XC3D because of the extra trailing dimension)
The following three arrays are set up by Write3D_info.
TT3D(nT3D) real Carrington times
These most likely will be the times spaced at
regular intervals in UT converted to Carrington times
XC3D(nLng,nLat,nRad,nT3D,3) real Shift needed to go back to source surface
(in Carrington variable). Will be negative.
Only XC3D(*,*,*,iT3D:jT3D,*) is used
VV3D(nLng,nLat,nRad,nT3D) real Velocity array
Only VV3D(*,*,*,iT3D:jT3D) is used
BRss(nLng,nLat,jT3D-kT3D+1) real scratch array; source surface magnetic field
BR3D(nLng,nLat,nRad) real scratch array; radial component written to file
BT3D(nLng,nLat,nRad) real scratch array; tangential component written to file
BN3D(nLng,nLat,nRad) real scratch array; normal component written to file
OUTPUTS:
(to file)
CALLED BY:
ipsdt
INCLUDE:
include 'sun.h'
include 't3d_array.h'
include 'b3d_param.h'
include 't3d_grid_fnc.h'
CALLS: ***
ArrR4Constant, ArrR4Interpolate, ArrR4TimesConstant, BField_Get, BadR4, FLINT, Say
T3D_get_grid, T3D_iget, T3D_iset, T3D_set, T3D_write_bb, cosd
PROCEDURE:
> TT3D may be only partially filled with valid times, e.g TT3D(kT3D:jT3D).
(invalid times are identified by the value BadR4()).
kT3D and jT3D are determined internally as the 1st and last valid time
(.ne. BadR4()) in TT3D. The input value iT3D must be greater/equal kT3D
and less/equal jT3D). Output files are produced only for times iT3D to jT3D.
kT3D usually is smaller than jT3D. Magnetic source surface data are collected
between time indices kT3D and jT3D. This ensures that heliospheric grid elements
at early times (just above iT3D) after traceback will still have a valid
time associated with them (above kT3D) at the source surface.
> The radial dependence of Br follows from flux conservation:
Br = BB*(RR/r)^2
The tangential component follows from geometrical considerations
by assuming that the magnetic field lies along the Parker spiral:
(Omega is angular velocity of Sun):
Bt/Br = r*cos(Lat)*Omega/V
Bt = BB*(Omega*RR*cos(Lat)/V)*(RR/r)
Output are 'normalized' magnetic field components (making the
values independent of radial distance):
r^2*Br = RR^2*BB
r *Bt = RR^2*BB *Omega*cos(Lat)/V
Expressing radial distances in units of r0 = 1 AU):
(r/r0)^2*Br = (RR/r0)^2*BB
(r/r0) *Bt = (RR/r0)^2*BB * r0*Omega*cos(Lat)/V
In terms of quantities defined in include file sun.h:
r0*Omega/V = SUN__AU*10^13*SUN__Omega*10^-6/(V[km/s]*10^5) = 100*SUN__AU*SUN__Omega/V[km/s]
We are mostly interested in magnetic field at Earth, i.e. about r0=1 AU.
Insitu magnetic field are usually expressed in nT, so we use the same units here.
We write 'normalized magnetic fields' in units of nT to file: (RR/r0)^2*Br for the radial
and (RR/r0)*Bt for the tangential component. These quantities should be more or less
constant across the heliosphere, since the radial dropoff has been taken out. At 1 AU
(RR/r0 = 1) it should reproduce the insitu values.
*TJD*'s unit troubles
X's output is in mT or 10^-2G. to bring to nT:
(15/215)^2 * (10^-6 T / mT) (10^9 nT/ T)
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
???-2002, Tamsen Dunn (UCSD/CASS; tdunn@ucsd.edu) Made time dep., fleshed out.
JUL-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Valid magnetic fields are returned only in grid points where the
source surface Br and V are valid. Previously Br would be valid
if only the source surface Br was valid (even if V was bad).
AUG-2002, Tamsen Dunn (UCSD/CASS; tdunn@ucsd.edu)
Altered Bt component to depend entirely on V3D. If V3D is bad, use VSS.
This revealed bug below:
SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Fixed big error in use of XC3D (did not take into account that the time dimension
was different from the V3D array). Now three pieces of information are expected
that are calculated by Write3D_info: TT3D, times at which magnetic fields are
required; XC3D and V3D: shifts and velocity at times TT3D. XC3D and V3D now have
the same dimensions.
JUN-2003, Paul Hick (UCSD/CASS)
Added processing of multiple magnetic field types
OCT-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
Added extra argument iT3D.
Fixed bug in magnetic field interpolation at source surface. Now for times before
the earliest source surface map Br is set to BadR4() instead of interpolating
on the earliest map itself.
[Previous]
[Next]
NAME:
write3D_infotd3D
PURPOSE:
Writes a 3D file and pertinent information at times
XCint(N) + half of the interval. (B Jackson, Mar., 2001)
XCint(N) values are the beginnings (and ends) of the time intervals used to select data. When the data selection
used is set to a daily cadence with a one day resolution, these XCint(N) values are the beginning and
ending midnight on Earth at the longitude the data is obtained. This may be different if one site is
used for density and one is used for velocity. In any case, the inputing XCint(N) values rule in the
selection of the matrix to be output from this routine. The actual start time of the time matrix XCtbeg
is set to the middle of the first set of these values and proceeds at precise nT interval values from this
value until the end value XCtbeg, which is the middle of the last interval. Thus, the time value for the
extraction of the matrix as near as possible should be the middle of the temporal XCint(N) intervals in
order to match the Earth location at noon. The motive here is to select an extract time when most of the
IPS sources are observed. If temporal intervals are set at a daily cadence, but at higher temporal
resolutions than one day, then the matrix output, should still be set to the middle of the interval.
CALLING SEQUENCE:
subroutine write3D_infotd3D(Mo,cPre,Nit,NiterT,Ninter,NCoff,XCintD,XCbe,XCtbeg,XCtend,iYr,RR,dRR,
& nLng,nLat,nMap,nT,nTmax,nCar,JDCar,
& PWV,PWG,PWRV,PWRG,DEN1AU,CONRV,CONRD,CONSTV,CONSTG,CONVT,CONDT,
& ClipLng,Scale,VMAP,DMAP,VV,DD,XCshift,Vratio,Dratio,V3D,D3D,LLbeg,LLend,XCTT,XC3DT,V3DT,D3DT)
INPUTS:
Mo integer Mode of operation 0 - no additional 1/R beyond 1 AU written
1 - an additional 1/R beyond 1 AU written
2
cPre character Character prefix for output files
Nit integer interation number
NiterT integer maximum number of iterations
Ninter integer # of intermediate steps
NCoff integer Carrington variable offset
XCintD(nTmax) double precision Beginning and ends of the time intervals used to select data
XCbe(2,nT) real Beginning (1,nT) and end (2,nT) of Carrington rotation times
XCtbeg real Start time
XCtend real End time
iYr integer year at beginning time
RR real radial distance of the source surface
dRR real radial resolution
nLng integer # longitudes
nLat integer # latitudes
nMap integer # radial distances
nT integer # of time values
nTmax integer maximum # of time values
nCar integer # Carrington rotations
JDCar double precision Julian Date at beginning of rotations
PWV real g-level power to fit velocity
PWG real g-level power to fit density
PWRV real radial g-level power to fit g density
(or radial density falloff for Thomson scattering)
PWRG real radial g-level power to fit V density
DEN1AU real Density at 1 AU
CONRV real Velocity spatial smoothing constant
CONRD real Density spatial smoothing constant
CONSTV real Velocity spatial hole-filling constant
CONSTG real Density spatial hole-filling constant
CONVT real Velocity temporal smoothing constant
CONDT real Density temporal smoothing constant
ClipLng real Clip longitude
Scale(4) real extra scaling factor (set to 1 if no scaling is required)
VMAP(nLng,nLat) real Velocity map at source surface
DMAP(nLng,nLat) real Density map at Source Surface
VV(nLng,nLat) real (scratch array) Velocity map at source surface
DD(nLng,nLat) real (scratch array) Density map at source surface
XCshift(nLng,nLat,nMap,nT,3) real shift amount from array
Vratio(nLng,nLat,nMap,nT) real velocity difference at height
Dratio(nLng,nLat,nMap,nT) real density difference at height
V3D(nLng,nLat,nMap) real 3D velocity matrix (dummy array) written out
D3D(nLng,nLat,nMap) real 3D density matrix (dummy array) written out - normalized to 1 AU
iStrAdd integer integer number of strings to be added to the file header
cfile(*)*(*) character strings to be added to the file header
OUTPUTS:
LLbeg integer beginning # of volumes to be exported
LLend integer end # of volumes to be exported
XCTT ((Ninter+1)*nT) real times (evenly spaced in UT)
XC3DT(nLng,nLat,nMap,(Ninter+1)*nT,3) real shifts needed to go back to source surface
V3DT(nLng,nLat,nMap,(Ninter+1)*nT) real 3 D velocity over time
D3DT(nLng,nLat,nMap,(Ninter+1)*nT) real Normalized 3 D density over time
CALLS: ***
ArrR4Bad, BadR4, EARTH8, Get3DTval, Get4Dval, T3D_fill_global, T3D_fill_time, T3D_set
T3D_write_nv, XMAP_SC_POS8
CALLED BY:
ipsdt
[Previous]
[Next]
NAME:
Write3D_nv
PURPOSE:
Converts the ratios of velocity and normalized density to
velocities and normalized densities. The arrays are written to
file, and are also returned as output array.
CALLING SEQUENCE:
subroutine Write3D_nv(VSS,DSS,XC3D,V3D,D3D)
INPUTS:
VSS(nLng,nLat) real source surface velocities (may contain bad values)
DSS(nLng,nLat) real source surface densities normalized to 1 AU
(may contain bad values)
XC3D(nLng,nLat,nRad) real 3D shift array
V3D (nLng,nLat,nRad) real velocity ratios
D3D (nLng,nLat,nRad real normalized density ratios
OUTPUTS:
V3D (nLng,nLat,nRad) real velocities
D3D (nLng,nLat,nRad real normalized densities
CALLS: ***
BadR4, FLINT, T3D_get, T3D_get_grid, T3D_set, T3D_write_nv
CALLED BY:
ipsd, ipsg2s, ipsg2t
INCLUDE:
include 't3d_array.h'
include 't3d_grid_fnc.h'
PURPOSE:
Calculate 3D velocity and normalized density arrays for
corotating tomography.
MODIFICATION HISTORY:
APR-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
Write3D_nv_UT
PURPOSE:
Writes output from tomographic reconstruction to ascii t3d* file at specified times.
The times are equally separated in UT.
Ouput are the 3D velocity and normalized density arrays, and, optionally,
the source surface maps, and los crossings maps.
As a secondary function the input arrays G2S and G3D are converted
to normalized density.
CATEGORY:
Tomography: I/O
CALLING SEQUENCE:
subroutine Write3D_nv_UT(NT,nCar,JDCar,XCbegMAT,XCendMAT,XCbegROI,XCendROI,VSS,G2S,XC3D,V3D,G3D,Vtmp,Gtmp)
INPUTS:
NT integer # times per day written to separate files
All times inside the time range covered by the reconstruction
rounded to a fraction 1.NT days is written, i.e.
for each day, times (I-1)*24.0/NT hours (I=1,NT) UT is used.
nCar integer # entries in JDCar
JDCar(nCar) real*8 Start times of Carrington rotation in Julian days
(except for the scratch arrays all input is read-only)
XCbegMAT(nTim) real start Carrington variable of matrix (- NCoff)
XCendMAT(nTim) real end Carrington variable of matrix (- NCoff)
(range of matrix typically is three Carrington rotations)
XCbegROI(nTim) real start Carrington variable of region of interest
XCendROI(nTim) real end Carrington variable of region of interest
(the region of interest typically covers one whole
Carrington rotation
VSS(nLng,nLat,nTim) real velocity at source surface RR (with bad values)
G2S(nLng,nLat,nTim) real nr^2 (normalized density) or g^2 at source surface at RR
(with bad values)
XC3D(3,nLng,nLat,nRad,nTim)
real shift from source surface (in Carrington variable (- NCoff))
V3D(nLng,nLat,nRad,nTim)real velocity ratio or velocity (no bad values)
G3D(nLng,nLat,nRad,nTim)real nr^2 / g^2 ratio or nr^2 / g^2 (no bad values)
Vtmp(nLng,nLat,nRad) real scratch array
Gtmp(nLng,nLat,nRad) real scratch array
GStmp(nLng,nLat) real scratch array
OUTPUTS:
(to t3d file)
CALLS: ***
BadR4, CvG2D, FLINT, FLINT8, Julian, Str2Str, T3D_get, T3D_get_grid, T3D_iget, T3D_iset
T3D_set, T3D_write_nv, XMAP_SC_POS, cosd
CALLED BY:
ipsg2, ipsg2s, ipsg2t
RESTRICTIONS:
V3D and G3D are not allowed to have bad values (the source surface arrays are used
to determine what is bad). V3D and G3D usually will be output from the last call
to SW_Model_Kinematic.
INCLUDE:
include 't3d_param.h'
include 't3d_array.h'
include 't3d_index.h'
include 't3d_grid_fnc.h'
include 't3d_loc_fnc.h'
PROCEDURE:
> This function should be called prior to Write3D_nv (which will modify its
input arrays V3D and G3D)
> G2S and V2S contain the source surface maps, which may contain bad values.
V3D and G3D contain velocity, and g^2 or nr^2, information without bad values.
If TOM__RATIO is not set then the source surface data are used
only to flag array elements as bad.
Several bits in MODE to control several aspects of the calculations.
TOM__MOD Carrington variables at the source surface are shifted into
the range [XCbeg,XCend] by applying a mod(XCend-XCbeg) operation.
TOM__G2 If set then input is in g^2 rather than normalized density nr^2
If set:
G2S is g^2 at source surface (with bad values)
G3D is 3D g^2 matrix (if TOM__RATIO not set) or
g^2 ratio (if TOM__RATIO set)
If not set:
G2S is nr^2 at source surface (with bad values)
G3D is 3D nr^2 matrix (if TOM__RATIO not set) or
nr^2 ratio (if TOM__RATIO set)
TOM__NORATIO If not set then V3D and G3D are ratios
If set:
V3D is the 3D velocity matrix
G3D is the g^2 matrix (if TOM__G2 set) or the
nr^2 matrix (if TOM__G2 not set)
MODIFICATION HISTORY:
SEP-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu), base on Write3D_nv
[Previous]
[Next]
NAME:
Write3D_nv_XC
PURPOSE:
Writes output from tomographic reconstruction to ascii t3d* files.
One file is written for each time in the tomographic reconstruction.
These time are equally separated in Carrington time.
Ouput are the 3D velocity and normalized density arrays, and, optionally,
the source surface maps, and los crossings maps.
As a secondary function the input arrays G2S and G3D are converted
to normalized density.
CATEGORY:
Tomography: I/O
CALLING SEQUENCE:
subroutine Write3D_nv_XC(XCbegMAT,XCendMAT,XCbegROI,XCendROI,VSS,G2S,XC3D,V3D,G3D,BINXV,BINXG)
INPUTS:
(except for the scratch arrays all input is read-only)
XCbegMAT(nTim) real start Carrington variable of matrix (- NCoff)
XCendMAT(nTim) real end Carrington variable of matrix (- NCoff)
(range of matrix typically is three Carrington rotations)
XCbegROI(nTim) real start Carrington variable of region of interest
XCendROI(nTim) real end Carrington variable of region of interest
(the region of interest typically covers one whole
Carrington rotation
VSS(nLng,nLat,nTim)
real velocity at source surface RR (with bad values)
G2S(nLng,nLat,nTim)
real nr^2 (normalized density) or g^2 at source surface at RR
(with bad values)
XC3D(3,nLng,nLat,nRad,nTim)
real shift from source surface (in Carrington variable (- NCoff))
V3D(nLng,nLat,nRad,nTim)
real velocity ratio or velocity (no bad values)
G3D(nLng,nLat,nRad,nTim)
real nr^2 / g^2 ratio or nr^2 / g^2 (no bad values)
BINXV(nLng,nLat,nTim) real # line-of-sight crossings on source surface for velocity
BINXG(nLng,nLat,nTim) real # line-of-sight crossings on source surface for density
OUTPUTS:
(to t3d file)
G2S(nLng,nLat,nTim)
real nr^2 (normalized density) at source surface (with bad values)
V3D(nLng,nLat,nRad,nTim)
real velocity matrix (with bad values)
G3D(nLng,nLat,nRad,nTim)
real nr^2 (normalized density) matrix (with bad values)
CALLS: ***
BadR4, CvG2D, FLINT, Str2Str, T3D_get, T3D_get_grid, T3D_iget, T3D_iset, T3D_set
T3D_write_nv, WR2DARR
CALLED BY:
ipsg2
INCLUDE:
include 't3d_param.h'
include 't3d_array.h'
include 't3d_index.h'
include 't3d_grid_fnc.h'
include 't3d_loc_fnc.h'
PROCEDURE:
G2S and V2S contain the source surface maps, which may contain bad values.
V3D and G3D contain velocity, and g^2 or nr^2, information without bad values.
The V3D and G3D matrices are updated using the source surface maps and the
shift array XC3D (if TOM__RATIO is not set then the source surface data are used
only to flag array elements as bad).
Several bits in MODE to control several aspects of the calculations.
TOM__MOD Carrington variables at the source surface are shifted into
the range [XCbeg,XCend] by applying a mod(XCend-XCbeg) operation.
TOM__G2 If set then input is in g^2 rather than normalized density nr^2
If set:
G2S is g^2 at source surface (with bad values)
G3D is 3D g^2 matrix (if TOM__RATIO not set) or
g^2 ratio (if TOM__RATIO set)
If not set:
G2S is nr^2 at source surface (with bad values)
G3D is 3D nr^2 matrix (if TOM__RATIO not set) or
nr^2 ratio (if TOM__RATIO set)
TOM__NORATIO If not set then V3D and G3D are ratios
If set:
V3D is the 3D velocity matrix
G3D is the g^2 matrix (if TOM__G2 set) or the
nr^2 matrix (if TOM__G2 not set)
TOM__BINX Write los crossings array to t3d file
TOM__SHIFT Write shift arrays XC3D to t3d file
MODIFICATION HISTORY:
SEP-1999, Paul Hick (UCSD/CASS)
DEC-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu), major rewrite
[Previous]
[Next]
NAME:
WriteI4GRD
PURPOSE:
Write integer*4 array as .grd file
CATEGORY:
ucsd/camera/for/lib
CALLING SEQUENCE:
subroutine WriteI4GRD(iType,iAct0,cFile,nX,nY,A,BadA,N11,N12,N21,N22,N31,N32,cFmt)
INPUTS:
iType integer
iAct0 integer open qualifier passed to bOpenFile.
This is added to OPN__TEXT+OPN__UNKNOWN+OPN__TRYINPUT+OPN__ONEPASS.
The only useful additional qualifier is OPN__NOMESSAGE to
suppress messages.
cFile character*(*) fully-qualified file name to be written
nX integer horizontal size of array (first dimension)
nY integer vertical size of array (second dimension)
A(nX,nY) integer array to be written to file
BadA integer BadI4() values in the input array are replaced by this value
before writing to file.
N11(2) integer
N12(2) integer
N21(2) integer
N22(2) integer
N31(2) integer
N32(2) integer
cFmt character*(*) either a valid format string, incl.
opening and closing bracket, or a
format for a single number without
brackets.
OUTPUTS:
A(nX,nY) integer only if BadA not equal BadI4().
BadI4() values have been replaced by BadA
CALLED BY:
smei_cal
INCLUDE:
include 'openfile.h'
CALLS: ***
BadI4, Int2Str, Str2Str, bOpenFile, iFreeLun, itrim
PROCEDURE:
MODIFICATION HISTORY:
JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
WriteLOSD
PURPOSE:
Writes a summary file of observed and modeled g-levels used
in the tomographic reconstruction for Cambridge IPS data
CALLING SEQUENCE:
subroutine WriteLOSD(cOut,cCam,iEdt,NL,iMJD,iXP,iYP,XOBS,XMDL0,XMDL,XE,NGOOD)
INPUTS:
cOut character*(*) Output file name
cCam character*(*) Logical pointing to directory where daily Cambridge
files are located
iEdt integer 0 = Unedited data; 1 = Edited data
NL integer # of IPS g-level los observations
iMJD(NL) integer MJD for original daily Cambridge file
iXP (NL) integer location in original daily Cambridge file (hour angle)
iYP (NL) integer location in original daily Cambridge file (declination)
(iMJD, iXP and iYP are output from ReadGIPS)
XOBS (NL) real Observed velocities (should match the entry
from the original record)
XMDL0(NL) real Model velocities after 1st iteration ??
XMDL (NL) real Model velocities
XE (NL) real source elongations (??)
NGOOD(NL) integer 0: bad IPS source; 1: good IPS source
OUTPUTS:
For each of the NL los observations the original record is retrieved from
the appropriate data file. Observed velocity, model velocity, difference
between observed and modeled velocity, and the 'bad source' flag are appended
to the record. The extended records are written to a file 'vipsout.dat' in
the current working directory.
CALLS: ***
bOpenFile, iFreeLun, iReadG
CALLED BY:
ipsd, ipsg2, ipsg2s, ipsg2t
INCLUDE:
include 'dirspec.h'
include 'openfile.h'
MODIFICATION HISTORY:
NOV-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
writelosmap
PURPOSE:
To write a line of sight source surface map
CATEGORY:
Data processing
CALLING SEQUENCE:
call writelosmap(NLOSGP1,NLG,NTG,NBS,ITIM,XLON,XLAT)
INPUTS:
NLOSGP1 integer Number of line of sight segments plus 1
NLG integer Number of lines of sight
NTG integer Number of time steps
NBS(NLG) integer Is the source line of sight used? 1 - yes 0 - no
ITIM(NLOSGP1,NLG) real Integer time map in which the line of sight belongs
XLON(NLOSGP1,NLG) real Projected longitude of the line of sight
XLAT(NLOSGP1,NLG) real Projected latitude of the line of sight
OUTPUTS:
a file
CALLS:
CALLED BY:
ipsdt
INCLUDE:
PROCEDURE:
MODIFICATION HISTORY:
July-2002, B. Jackson (UCSD; bvjackson@ucsd.edu)
[Previous]
[Next]
NAME:
WriteLOSY
PURPOSE:
Writes a summary file of observed and modeled velocities used
in the tomographic reconstruction.
CALLING SEQUENCE:
subroutine WriteLOSY(cOut,cWildVIPS,NL,IYRF,IREC,XOBS,XMDL0,XMDL,XE,NGOOD)
INPUTS:
cOut character*(*) Output file name
cWildVIPS character*(*) File wildcard identifying the type
of IPS data used (Nagoya or Ooty)
NL integer # of IPS velocity los observations
IYRF (NL) integer year of observations (identifies the data file
from which the original source data were read
IREC (NL) integer record number on original data file
(IYRF and IREC are output from ReadVIPS)
XOBS (NL) real Observed velocities (should match the entry
from the original record)
XMDL0(NL) real Model velocities after 1st iteration ??
XMDL (NL) real Model velocities
XE (NL) real source elongations (??)
NGOOD(NL) integer 0: bad IPS source; 1: good IPS source
OUTPUTS:
For each of the NL los observations the original record is retrieved from
the appropriate data file. Observed velocity, model velocity, difference
between observed and modeled velocity, and the 'bad source' flag are appended
to the record. The extended records are written to a file 'cOut'
CALLS: ***
Int2Str, bOpenFile, iFreeLun, itrim
CALLED BY:
ipsd, ipsg2, ipsg2s, ipsg2t
INCLUDE:
include 'dirspec.h'
include 'openfile.h'
RESTRICTIONS:
Works only when original data are stored in yearly files (e.g.
Nagoya and Ooty IPS data).
MODIFICATION HISTORY:
NOV-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
[Previous]
[Next]
NAME:
writem_scomp
PURPOSE:
Write Model and Source comparison information into a file.
CALLING SEQUENCE:
call writem_scomp(Mo,NCoff,XCint,Nit,cStrname,nTmax,nT,NL,PW,RATIO,
& NLmax,NSR,SRC,DOYS,XCE,OBS,AMOD,XLON,XCtpr,NLOSP1,FIX,SSIG,NBS)
INPUTS:
Mo integer 1 Write out velocities
2 Write out densities
NCoff integer Carrington rotation offset
XCint(nTmax) real Time interval boundary values
Nit integer Iteration number
cStrname character name for the output file
nT integer number of time values
nTmax integer maximum number of time values
NL integer number of sources
PW real power of g-level to density
RATIO real ratio
NLmax integer maximum number of source values
NSR(NL) integer source counter 0 or 1
SRC*(NL) character source name
SRCS* character source name
DOYS(NL) real doy of the year
XCE(NL) real Day of year in Carrington Coordinates
OBS(NL) real Observed value
AMOD(NL) real Modeled value
XLON(NL) real Longitude of the source surface projected source point P value
XCtpr(NL) real Carrington time of the source surface projected source point P value
NLOSP1 integer Number of sources lines of sight plus one
FIX(NL) real Ratio of the source to modeled value
SSIG(NL) real Source sigma value
NBS(NL) real Source good or bad check
OUTPUTS:
CALLS: ***
ArrI4Zero
CALLED BY:
ipsdt
[Previous]
[Next]
NAME:
WriteR4GRD
PURPOSE:
Write real*4 array as .grd file
CATEGORY:
ucsd/camera/for/lib
CALLING SEQUENCE:
subroutine WriteR4GRD(iType,iAct0,cFile,nX,nY,A,BadA,N11,N12,N21,N22,N31,N32,cFmt)
INPUTS:
iType integer
iAct0 integer open qualifier passed to bOpenFile.
This is added to OPN__TEXT+OPN__UNKNOWN+OPN__TRYINPUT+OPN__ONEPASS.
The only useful additional qualifier is OPN__NOMESSAGE to
suppress messages.
cFile character*(*) fully-qualified file name to be written
nX integer horizontal size of array (first dimension)
nY integer vertical size of array (second dimension)
A(nX,nY) real array to be written to file
BadA real BadI4() values in the input array are replaced by this value
before writing to file.
N11(2) integer
N12(2) integer
N21(2) integer
N22(2) integer
N31(2) integer
N32(2) integer
cFmt character*(*) either a valid format string, incl.
opening and closing bracket, or a
format for a single number without
brackets.
OUTPUTS:
A(nX,nY) integer only if BadA not equal BadI4().
BadI4() values have been replaced by BadA
CALLED BY:
smei_cal_write
INCLUDE:
include 'openfile.h'
CALLS: ***
BadR4, Int2Str, Str2Str, bOpenFile, iFreeLun, itrim
PROCEDURE:
MODIFICATION HISTORY:
JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)