📄 jave-ppp.txt
字号:
}
//***** inner loop over sats (data processing here)
//***** check empty and 0.0 fields and store null (dnull) instead
//***** internal ordering P1,P2,L1,L2,C1,D1,D2 (1-7)
nobs=0;
for (int i=1; i<=nsats; i++){
for (int icol=0; icol < 8; icol++){
data[icol]=dnull;
}
myString=in.readLine();
if(myString.length() < 79)
myString=new String(myString+getSpaces(80));
for (int icol=1; icol<=Math.min(5,rinStuf.getNdat()); icol++){
subField = myString.substring(16*(icol-1), 16*(icol-1)+14);
if(subField.equals(" ")){
dval=dnull;
}else{
dval=Double.valueOf(subField.trim()).doubleValue();
}
data[rinStuf.getKind(icol)]=dval;
}
//***** two-line data records
if(rinStuf.twoLine()){
myString=in.readLine();
if(myString.length() < 79)
myString=new String(myString+getSpaces(80));
for (int icol=6; icol<=rinStuf.getNdat(); icol++){
subField = myString.substring(16*(icol-6), 16*(icol-6)+14);
if(subField.equals(" ")){
dval=dnull;
}else{
dval=Double.valueOf(subField.trim()).doubleValue();
}
data[rinStuf.getKind(icol)]=dval;
}
}
//***** internal ordering P1,P2,L1,L2,C1,D1,D2 (1-7)
p1=data[1];
p2=data[2];
c1=data[5];
ntot=ntot+1;
if(p1 >= dnull && c1 < dnull){
p1=c1; //*** use c1 if no p1
lc1=true; //*** increment nc1 if p2 present
}else{
lc1=false;
}
//*** must have p1 and p2 (if dual f.) (and be healthy)
//*** test for vert angle cutoff
if( myBCS.BChealthy(iprns[i], tsec) ){ //*** healthy?
if((!myModes.isdFreq() && p1 < dnull) ||
( myModes.isdFreq() && p1 < dnull && p2 < dnull) ){
if(myBCS.BCcutoff(iprns[i], tsec, rxPos,myModes,mySP3) ){
nvmask=nvmask+1; //*** running sum
}else{
nobs=nobs+1;
nboth=nboth+1; //*** running sum
if(lc1) nc1=nc1+1; //*** running sum
p1s[nobs] = p1;
p2s[nobs] = p2;
kprns[nobs] = iprns[i];
}
}
//*** diagnostic print -- could delete 'else' clause if convenient
}else{
//********* System.out.println("ill= " + iprns[i] + " " + tsec);
}
}//***endfor (inner loop over sats)
if(nobs > 3){
newPos=myBCS.p1xyz(nobs, p1s, p2s, kprns, tsec, rxPos, myModes,
mySP3);
putOut02(outBW, tsec, nobs, newPos);
}else{
ndrop=ndrop+nobs;
}
}//***endwhile (outer loop over all epochs)
}
catch (IOException e) {
System.err.println("Error-- IO \n" + e.toString());
System.exit(1);
}
System.out.println("input="+ntot+" c1="+nc1+" both="+nboth+
" vmask="+nvmask+" drop="+ndrop);
}
private void putOut01(BufferedWriter outBW, int iprn, double p1, double va){
//*** output pseudorange data
String iprS, p1S, vaS, myStr;
try {
iprS = colInt (iprn, 2);
p1S = colDouble(p1, 8, 3);
vaS = colDouble(va*RAD, 2, 2);
myStr=""+iprS+" "+p1S+" "+vaS;
outBW.write(myStr, 0, myStr.length());
outBW.newLine();
}
catch (IOException e) {
System.err.println("Output fail\n" + e.toString());
System.exit(1);
}
}
private void putOut02(BufferedWriter outBW, double tsec, int nobs,
PosD newPos){
//*** output time tag
double eht;
String tsecS, nobS, glaS, gloS, ehtS, pdopS, hdopS, vdopS, myStr;
newPos.xyzgeoD();
//*** sanity check
eht = newPos.getEhtGPD();
if(eht < -9999.0 || eht > 9999.0) return;
try {
tsecS = colDouble(tsec, 6, 3);
nobS = colInt (nobs, 2);
glaS = colDouble(newPos.getGlaGPD()*RAD, 3, 6);
gloS = colDouble(newPos.getGloGPD()*RAD, 4, 6);
ehtS = colDouble(newPos.getEhtGPD(), 5, 4);
pdopS = colDouble(newPos.getpdopPosD(), 2, 1);
hdopS = colDouble(newPos.gethdopPosD(), 2, 1);
vdopS = colDouble(newPos.getvdopPosD(), 2, 1);
myStr = ""+tsecS+" "+nobS+" "+glaS+" "+ gloS+" "+ehtS+
" "+pdopS+" "+hdopS+" "+vdopS;
outBW.write(myStr, 0, myStr.length());
outBW.newLine();
}
catch (IOException e) {
System.err.println("Output fail\n" + e.toString());
System.exit(1);
}
}
private String colInt(int ival, int icols){
//*** format an integer
String ivalS;
StringBuffer ivalSB;
NumberFormat myF = NumberFormat.getNumberInstance();
FieldPosition myFP= new FieldPosition(NumberFormat.INTEGER_FIELD);
myF.setMaximumIntegerDigits(icols);
myF.setMinimumIntegerDigits(1);
myF.setMaximumFractionDigits(0);
myF.setMinimumFractionDigits(0);
myF.setGroupingUsed(false);
ivalSB= myF.format(ival, new StringBuffer(), myFP);
return getSpaces(icols-myFP.getEndIndex()) + ivalSB;
}
private String colDouble(double val, int icols, int idec){
//*** format a double for integer and fractional parts
String valS;
StringBuffer valSB;
NumberFormat myF = NumberFormat.getNumberInstance();
FieldPosition myFP= new FieldPosition(NumberFormat.INTEGER_FIELD);
myF.setMaximumIntegerDigits(icols);
myF.setMinimumIntegerDigits(1);
myF.setMaximumFractionDigits(idec);
myF.setMinimumFractionDigits(idec);
myF.setGroupingUsed(false);
valSB = myF.format(val, new StringBuffer(), myFP);
return getSpaces(icols-myFP.getEndIndex()) + valSB;
}
public static String getSpaces(int n){
//*** routine to build a string with a given number of spaces
StringBuffer sb = new StringBuffer(n);
for(int i=0; i<n; i++) sb.append(' '); //*** accum spaces in buffer
return sb.toString();
}
private void openFiles(String inFileName, String in2FileName,
String inpFileName ){
try {
in = new BufferedReader(
new InputStreamReader(new FileInputStream (inFileName)));
in2 = new BufferedReader(
new InputStreamReader(new FileInputStream (in2FileName)));
outBW = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream ("outfile")));
//*** precise orbit is optional
if(inpFileName == null){
inp = null;
}else{
inp = new BufferedReader(
new InputStreamReader(new FileInputStream (inpFileName)));
}
}
catch (IOException e) {
System.err.println("Files not opened\n" + e.toString());
System.exit(1);
}
}
private String readln() throws IOException{
//*** read a line from input -- convert to String
//*** warning -- logic for DOS only!!!
char ca[] = new char [200]; //*** store the characters
int n=0; //*** length of string
eol: {
boolean lcr; //*** last char was "cr"
for(int i=0; i<ca.length; ++i){
char c=(char)System.in.read(); //*** read a character
if(c == '\n'){
lcr=false;
break eol; //*** end of line -- break
}else if(c == '\r'){
lcr=true;
}else{
lcr=false;
ca[n]=c; //*** store character
n=n+1; //*** count them
}
}
}//*** end eol label
//*** convert n chars of array to String
return new String(ca,0,n);
}
}
//****************************************************************************
class Rinx {
//*** Rinex File class -- Rinx
private int ndat=0; //*** number of data types
//*** internal ordering P1,P2,L1,L2,C1,D1,D2 (0-6)
private static final String Kinds[]={"P1","P2","L1","L2","C1","D1","D2"};
private static final int maxKind=7;
private int icols[] = new int[maxKind+1]; //*** index (fortran-subscripts)
//*** methods
public Rinx() {} //*** constructor
public void putNdat(int i) {
if(i <= 0 || i > maxKind){
System.err.println("Error--Rinx.putNdat()");
System.err.println("Error--range error =" + i);
System.exit(1);
}
ndat=i;
}
public int getNdat() {return ndat;}
public boolean twoLine() {return ndat>=6;} //*** 2 lines/obs
//*** data kind methods
public int getKind(int i) {return icols[i];}
public void putKind(String Kind, int icol){
//*** routine to place column indicies (returns internal order index)
//*** note: columns follow fortran indexing
int ival=-1;
my1: for (int i=0; i<Kinds.length; i++){
if(Kind.equals(Kinds[i])){
ival=i+1; //*** convert to fortran index
break my1;
}
}//***endfor
if(ival == -1){
System.err.println("Error--Rinx.putKind()");
System.err.println("Error--Rinex data kind =" + Kind);
System.exit(1);
}
icols[icol]=ival; //*** map column to kind
}
}//***endclass Rinx
//************************************************************************
class BCset {
//*** collection of broadcast orbits object
private static final int mxprn = 32; //*** 38 are possible
private static final int mxtrw = 48; //*** time rows (2-3 days)
private static final double sol = 299792458.0; //*** exactly
private static final double we = 7.2921151467e-5; //*** rad/sec
private static final double gpspi = 3.1415926535898e0; //*** exactly
private static final double RAD = 180.0/Math.PI; //*** radians to deg
private Gtime tStuf;
private BCstuf allBC[][] = new BCstuf[mxprn+1][mxtrw+1]; //*** fortran style
private int nrwBC[] = new int [mxprn+1];
private static final double GAMMA = (77.0/60.0)*(77.0/60.0);
private static final double GAMMA1= 1.0 - GAMMA;
//*** broadcast ionosphere stuff
private boolean BCSiono = false;
private double alfa1 = 0.0;
private double alfa2 = 0.0;
private double alfa3 = 0.0;
private double alfa4 = 0.0;
private double beta1 = 0.0;
private double beta2 = 0.0;
private double beta3 = 0.0;
private double beta4 = 0.0;
//*** tropo object
private Met myMet;
//*** global (kludge -- don't want an extra lookup function right now)
private double bcclok; //*** broadcast sv clock corrector (ltloop)
//*** constructor
public BCset(BufferedReader in, Gtime tStufIn) {
for(int i=0; i<=mxprn; ++i) {nrwBC[i]=0;} //*** empty rows
tStuf=tStufIn;
myMet = new Met();
doNavHeader(in); //*** nav file header
doNavData(in);
}
//***
//*** load methods only accessed thru constructor
//***
private void doNavData(BufferedReader in){
//*** loop over nav file data
String myString;
String typeField;
int icount;
int myprn;
double delt;
BCstuf myBC;
//*** loop until end of file
icount=0;
try {
while( (myString=in.readLine()) != null ){
icount=icount+1;
myBC=readEntry(in,myString,icount);
myprn=myBC.gBCprn();
if(nrwBC[myprn] == mxtrw){
System.err.println("Array overflow in doData():"+myprn);
System.exit(1);
}
//*** remaining logic to load array
//*** load unhealthy sats (i.e. no health check)
if(nrwBC[myprn] == 0){ //*** first entry for prn
nrwBC[myprn]++;
allBC[myprn][nrwBC[myprn]]=myBC;
}else{
delt = myBC.gBCjts() - allBC[myprn][nrwBC[myprn]].gBCjts();
if(Math.abs(delt) < 1.0){ //*** duplicate
allBC[myprn][nrwBC[myprn]]=myBC; //*** no increment/overwrite
}else if(Math.abs(delt) > 1800.0){ //*** normal update
nrwBC[myprn]++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -