Regarding CPF File Parser Usage

Hello Orekit residents,

I am trying to use the CPFParser module but couldn’t really figure out how to proceed with it. I downloaded a sample data file from ILRS website and denoted it as my source with DataSource method:

from org.orekit.files.ilrs import CPFParser, CPF
from org.orekit.data import DataSource

data_source = DataSource('hy2d_cpf_220801_21301.sha.txt')
parser = CPFParser.parse(data_source)

Yet here I cannot implement the parse to this DataSource method. I run through the documentation but unfortunately couldn’t make any understanding, so I wanted to ask you about this.

How can I read the data stored in a CPF file? I would love have a discussion on this subject with you.

Thank you in advance for your help and time,
Baris

Hi @Echulion,

I’m not very familiar yet with the CPF-related classes but, as a general rule, looking through the Orekit Java tests can be of great help to understand the usage of a class (especially if there is no related tutorial).
Here, looking at CPFParserTest you will find an example (in Java, I must admit):

        // Simple test for version 2.0, only contains position entries
        final String ex = "/ilrs/jason3_cpf_180613_16401.cne";

        final CPFParser parser = new CPFParser();
        final String fileName = Paths.get(getClass().getResource(ex).toURI()).toString();
        final CPF file = (CPF) parser.parse(new DataSource(fileName));

So maybe what you missed is casting the parsed object to a CPF object ?

1 Like

Hello @MaximeJ,

Thank you for your quick reply. I have managed to use the method thanks to the example you have shared! After parsing the source file, I had to call the satellite with its proper COSPAR ID.