RinexObservationFile.java

Hi,

Thanks for your great project. I am a new user of orekit and java and need your help to read the observation RINEX observation files. I read the RinexObservationFile.java in the tutorial and understand it. I have two questions:

  1. The output of the RinexObservationFile.java is in UTC. How Can I extract it in GPS time (as in RINEX file)?

  2. The output of the od.getvalues (line 132) is GPS observations. These observations are printed with %9.3f format. I increase the format to %9.5f, but the output only 3 digits after . and the other digits are printed as zero (e.g. 128445607.04900 is printed but the real values is 128445607.04948). It is very important to read the GPS observations correctly. Could you please help me with this matter? Are they loaded correctly? if yes, what should I do to print it correctly?

Thank you and best regards
Amir

Hi @AmirAllahvirdi

First, welcome to the Orekit forum!

For that point, you can compute the offset between UTC and GPS scales for the measurement dates. For that dates, it was 17 seconds but you can also compute it. For the second point, you can replace the following block:

                    if (print) {
                        System.out.format(Locale.US, " %s            %s       %s           %s             %15s     %9.3f%n",
                                          observationDataSet.getDate(),
                                          system, prn, od.getSignalStrength(),
                                          od.getObservationType().getMeasurementType(), od.getValue());
                    }

With

                    if (print) {
                        final AbsoluteDate utcDate = observationDataSet.getDate();
                        final double offset = utcDate.durationFrom(new AbsoluteDate(utcDate.toString(), TimeScalesFactory.getGPS()));
                        System.out.format(Locale.US, " %s            %s       %s           %s             %15s     %9.3f%n",
                                          utcDate.shiftedBy(offset),
                                          system, prn, od.getSignalStrength(),
                                          od.getObservationType().getMeasurementType(), od.getValue());
                    }

For the value 128445607.04948:

  • 128445607.049 is the real value. Therefore, the format 9.3 is correct.
  • The second 4 represents the signal loss of lock.
  • 8 represents the signal strength

You can find all that information in the official Rinex documentation.

Kind regards,
Bryan

1 Like

@bcazabonne Thanks for your help. Best regards. Amir

Note that AbsoluteDate is not in any particular time scale, but the toString() method prints the date in UTC. You should use date.toString(TimeScalesFactory.getGPS()) to print the date in the GPS time scale.

1 Like

Dear @bcazabonne,

I appreciate it if you help me with the following matter:

I want to load a RINEX file and use its observations in my algorithm. Based on the RinexObservationFile.java, I load the file as follows:

RinexLoader loader = new RinexLoader(nd.getStreamOpener().openStream(), nd.getName()); // initialize RINEX loader

Then, I put the observations in the following list:

List<ObservationDataSet> rinexData=loader.getObservationDataSets();

My problem is that I can not access to the getObservationType() and getValue(), or getObservationData() methods. I am new to java and need some help in the early steps.

Thank you and best regards
Amir

This may be due to the fact that the file was not read correctly. The reason may be that the location of the file was not found. As a result, the list of observation data sets may be empty.
Is it possible to see how you read the file?

Thank you
Bryan

1 Like

I read the file as you read in the tutorial:

        // input in tutorial resources directory
        final String inputPath = RinexImport.class.getClassLoader().getResource("inputs/GRCC2130.18O").toURI().getPath(); // get the pathname of input file as string
        final File file = new File(inputPath);//converting the given pathname string into an abstract pathname

        // set up filtering for measurements files
        NamedData nd = new NamedData(file.getName(), () -> new FileInputStream(new File(file.getParentFile(), file.getName())));//open file with FileInputStream
        for (final DataFilter filter : Arrays.asList(new GzipFilter(),
                                                     new UnixCompressFilter(),
                                                     new HatanakaCompressFilter())) {
            nd = filter.filter(nd);
        }
                              
        
        RinexLoader loader = new RinexLoader(nd.getStreamOpener().openStream(), nd.getName()); // initialize RINEX loader
        List<ObservationDataSet> rinexData=loader.getObservationDataSets();

When I checked the size of the rinexData (System.out.println(rinexData.size());), it get the 75375. The procedure that you used in the tutorial to read the RINEX data (by using for-each) works. I am wondering why I can not use the mentioned methods when I load it as above?

Regards
Amir

I found the solution, to access to a particular data (e.g. fist observation), I need to use the following line:

 System.out.println(rinexData.get(0).getObservationData().get(0).getValue());

Hi Amir,

Sorry for my late answer.
What you have to do is first to looping on observation data sets and then on the observation data contained inside the data set. Indeed, an observation data set contains several observation data (2 range measurements, 2 phase measurements and 2 signal strengths for instance). In order to perform the two loops, you have 2 solutions:

  1. Use for-each instruction

     // loop on observation data set
     for (final ObservationDataSet observationDataSet : loader.getObservationDataSets()) {
    
         // loop on observations
        for (final ObservationData od : observationDataSet.getObservationData()) {
            System.out.println(od.getValue());
        }
    
     }
    
  2. Use classical for loop

     // loop on observation data set
     final List<ObservationDataSet> dataSets = loader.getObservationDataSets();
     for (int i = 0; i < dataSets.size(); i++) {
    
         // loop on observations
         for (int j = 0; j < dataSets.get(i).getObservationData().size(); j++) {
             System.out.println(dataSets.get(i).getObservationData().get(j).getValue());
         }
    
     }
    

I prefer the first one because iteration variables are not very easy to read.
In the tutorial, I also perform a filtering of the measurements in order to keep only the measurements from GPS-01. This is done by the instruction:

        if (observationDataSet.getSatelliteSystem() == system &&
                        observationDataSet.getPrnNumber() == prn) {

        }

Kind regards,
Bryan

1 Like

Thank you Bryan for your great answer.

Best regards,
Amir