Extracting the platform heading with snapppy?


#1

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.


Extracting the platform heading with snapppy?
Extracting the platform heading with snapppy?
#2

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?


#3

Please specify your issue.

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

#4

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


#5

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.


#6

No this was not me.


#7

very strange.


#8

I’ve now merged both into one topic.


#9

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


#10

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


#11

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


#12

Yes it is in the original product metadata:


#13

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


#14

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.


#15

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


#16

Perfect. Thank you