Extracting the platform heading with snapppy?

I was able to parse the XML files from the annotations directory to extract the platform heading.

Is it possible to do so with the snappy python api?

Data: Sentinel-1
Aim: ensure downloaded data to be processed is of a particular heading.
What I did so far: use the XML python module to parse and extract the heading from the annotations XML.

I was able to parse the XML files from the annotations directory to extract the platform heading.

Is it possible to do so with the snappy python api?

Please specify your issue.

  • What data are you using?
  • What is your aim?
  • What did you test so far?

This is an exact duplicate of my question: Extracting the platform heading with snapppy?

Thank you for the hint: Did you create this as a new user or was your query simply copied by another person? Both is not appreciated according to the board rules.

No this was not me.

very strange.

I’ve now merged both into one topic.

In this thread it is shown how you can access the metadata of a product:

For the API you can have a look at the Doc of these two classes:
MetadataElement
MetadataAttribute

This I already use. However the heading/azimuth is not in the abstracted metadata but in the annotations.

Then this information is not read and not put into the data model.
Or is it may be in the Original_Product_Metadata path and not in the Abstracted_Metadata?

image

Yes it is in the original product metadata:

So you can read it from there. That’s good.

Yes but I am batch processing data and need to extract it programatically. So as a reminder I mentioned having parsed the xml to extract it however I wanted to know if it can be done with snappy like in the elements found in the abstracted metadata.

Yes, you can do it with snappy. You just need to replace the element names in the above-linked thread.
Your python code would look like:

annotationElem = product.getMetadataRoot().getElement('Original_Product_Metadata').getElement('annotation')
elems = annotationElem.getElements()
# iterate ove elements for the one  you need
generalInfoElem = origAnnotationElem.getElement('product').getElement('generalAnnotation').getElement('productInformation')
heading = generalInfElem.getAttributeString('platformHeading')
#parse the string

1 Like

Perfect. Thank you

Hello, everyone. I intend to use the platform heading angle in the GPS LOS projected formula, extracted from the original metadata of my Sentinel-1 images. The value obtained is approximately -6.1 degrees. Should I use it as -6.1 degrees in the formula?