Child pages
  • Developer FAQ
Skip to end of metadata
Go to start of metadata

Is it possible to call C routines from Java?

Please, refer to the Java Native Interface(JNI) at the Sun Java documentation pages.

How can I get geo-location data from MERIS products with the API?

The way to get geo-location data is the same as for "normal" bands. Just use the band IDs "latitude" and "longitude".

How can I read a metadata attribute from MERIS products?

Example for MERIS Sun Spectral Fluxes:

MetadataElement root = product.getMetadataRoot();
MetadataElement elem = root.getElement("Scaling_Factor_GADS");
MetadataAttribute attr = elem.getAttribute("sun_spec_flux");
// In order to obtain the actual data you have
// two choices. The first relies on the fact that
// "sun_spec_flux" is stored as 15 float elements
// (refer to ENVISAT MERIS product structure in
// VISAT help) and is thus very simple:
float[] sunSpecFluxes = (float[]) attr.getDataElems();

// The more general and type-safe but therefore expensive
// approach is the following:
ProductData data = attr.getData();
float[] sunSpecFluxes = new float[data.getNumElems()];
for (int i = 0; i < sunSpecFluxes.length; i++) {
    sunSpecFluxes[i] = data.getFloatElemAt(i);

How can I read the AATSR "attachment flag" as defined in the ENVISAT Product Specifications?

The "attachment flag" is a field the "SUMMARY_QUALITY_ADS" annotation dataset record. It can be accessed as attribute in the metadata of an AATSR N1 product as follows:

MetadataElement root = product.getMetadataRoot();
MetadataElement sqAds = root.getElement("SUMMARY_QUALITY_ADS");
if (sqAds != null) {
    int sqAdsRecCount = sqAds.getNumElements();
    for (int i = 0; i < sqAdsRecCount; i++) {
        MetadataElement sqAdsRec = sqAds.getElementAt(i);
        final MetadataAttribute attachFlagAttr = sqAdsRec.getAttribute("attach_flag");
        final int attachFlag = attachFlagAttr.getData().getElemInt();
        System.out.printf("attach_flag[%d] = %d\n", i, attachFlag);

An alternative would be to read it via the org.esa.beam.dataio.envisat.ProductFile class. A starting point is to open the AATSR file using

Why is there a difference between the values of view-zenith (Sun-zenith,..) I extracted with the readPixel method of TiePointGrid.class and the values displayed by Visat?

The VISAT display is correct, TiePointGrid.readPixels and also TiePointGrid.getPixels return the "wrong" values with an relative error of about 0.05 percent. The reason is, that a tie-point is supposed to be located in the center of a pixel at (x+0.5,y+0.5) and the mentioned methods return the values for (x,y) ignoring the offset.

How do I reference a metadata element in an expression? Let's say for example that I have following expression that I want to pass to the BandArithmetic - class:

PI * radiance_1 / sun_spec_flux * cos(solar_zenith)
where: 'sun_spec_flux' is the value stored in the 'Scaling_Factor_GADS.sun_spec_flux' metadata element

  • No labels