<commit_before>package org.helioviewer.viewmodel.metadata;

import org.helioviewer.base.logging.Log;
import org.helioviewer.base.math.MathUtils;
import org.helioviewer.base.math.Vector2dDouble;
import org.helioviewer.base.math.Vector2dInt;
import org.helioviewer.base.physics.Constants;
import org.helioviewer.viewmodel.view.cache.HelioviewerDateTimeCache;
import org.helioviewer.viewmodel.view.jp2view.datetime.ImmutableDateTime;

/**
 * Implementation of MetaData representing solar images.
 * 
 * <p>
 * This class is supposed to be for solar images. Currently, it supports the
 * observatory SOHO with its instruments EIT, LASCO and MDI, as well as some
 * instruments on board of the observatory STEREO.
 * 
 * @author <NAME>
 * @author <NAME>
 * 
 */
public class HelioviewerMetaData extends AbstractMetaData implements SunMetaData, ObserverMetaData, ImageSizeMetaData, NonConstantMetaData {

    protected MetaDataContainer metaDataContainer;
    private String instrument = "";
    private String detector = "";
    private String measurement = " ";
    private String observatory = " ";
    private String fullName = "";
    private Vector2dInt pixelImageSize = new Vector2dInt();
    private double solarPixelRadius = -1;
    private Vector2dDouble sunPixelPosition = new Vector2dDouble();

    private double meterPerPixel;
    private ImmutableDateTime time;

    /**
     * Default constructor.
     * 
     * Tries to read all informations required.
     * 
     * @param m
     *            Meta data container serving as a base for the construction
     */
    public HelioviewerMetaData(MetaDataContainer m) {

        metaDataContainer = m;

        if (m.get("INSTRUME") == null)
            return;

        detector = m.get("DETECTOR");
        instrument = m.get("INSTRUME");

        if (detector == null) {
            detector = " ";
        }
        if (instrument == null) {
            instrument = " ";
        }
        updateDateTime();
        updatePixelParameters();

        setPhysicalLowerLeftCorner(sunPixelPosition.scale(-meterPerPixel));
        setPhysicalImageSize(new Vector2dDouble(pixelImageSize.getX() * meterPerPixel, pixelImageSize.getY() * meterPerPixel));

        if (instrument.contains("AIA")) {
            instrument = "AIA";
            measurement = m.get("WAVELNTH");
            observatory = m.get("TELESCOP");
            fullName = "AIA " + measurement;
        }

        else if (instrument.contains("SWAP")) {
            instrument = "SWAP";
            measurement = m.get("WAVELNTH");
            observatory = m.get("TELESCOP");
            fullName = "SWAP " + measurement;
        }
        else if (instrument.contains("GONG")) {
            instrument = "GONG";
            measurement = m.get("WAVELNTH");
            observatory = m.get("TELESCOP");<commit_msg>data: Changed the configuration of Gong Halpha to hopefully the correct one<commit_after>package org.helioviewer.viewmodel.metadata;

import org.helioviewer.base.logging.Log;
import org.helioviewer.base.math.MathUtils;
import org.helioviewer.base.math.Vector2dDouble;
import org.helioviewer.base.math.Vector2dInt;
import org.helioviewer.base.physics.Constants;
import org.helioviewer.viewmodel.view.cache.HelioviewerDateTimeCache;
import org.helioviewer.viewmodel.view.jp2view.datetime.ImmutableDateTime;

/**
 * Implementation of MetaData representing solar images.
 * 
 * <p>
 * This class is supposed to be for solar images. Currently, it supports the
 * observatory SOHO with its instruments EIT, LASCO and MDI, as well as some
 * instruments on board of the observatory STEREO.
 * 
 * @author <NAME>
 * @author <NAME>
 * 
 */
public class HelioviewerMetaData extends AbstractMetaData implements SunMetaData, ObserverMetaData, ImageSizeMetaData, NonConstantMetaData {

    protected MetaDataContainer metaDataContainer;
    private String instrument = "";
    private String detector = "";
    private String measurement = " ";
    private String observatory = " ";
    private String fullName = "";
    private Vector2dInt pixelImageSize = new Vector2dInt();
    private double solarPixelRadius = -1;
    private Vector2dDouble sunPixelPosition = new Vector2dDouble();

    private double meterPerPixel;
    private ImmutableDateTime time;

    /**
     * Default constructor.
     * 
     * Tries to read all informations required.
     * 
     * @param m
     *            Meta data container serving as a base for the construction
     */
    public HelioviewerMetaData(MetaDataContainer m) {

        metaDataContainer = m;

        if (m.get("INSTRUME") == null)
            return;

        detector = m.get("DETECTOR");
        instrument = m.get("INSTRUME");

        if (detector == null) {
            detector = " ";
        }
        if (instrument == null) {
            instrument = " ";
        }
        updateDateTime();
        updatePixelParameters();

        setPhysicalLowerLeftCorner(sunPixelPosition.scale(-meterPerPixel));
        setPhysicalImageSize(new Vector2dDouble(pixelImageSize.getX() * meterPerPixel, pixelImageSize.getY() * meterPerPixel));

        if (instrument.contains("AIA")) {
            instrument = "AIA";
            measurement = m.get("WAVELNTH");
            observatory = m.get("TELESCOP");
            fullName = "AIA " + measurement;
        }
        else if (instrument.contains("GONG")) {
            instrument = "SWAP";
            measurement = m.get("WAVELNTH");
            observatory = m.get("TELESCOP");
            fullName = "GONG " + measurement;
        }
        else if (instrument.contains("SWAP")) {
            instrument = "SWAP";
            measurement = m.get("WAVELNTH");
            observatory = m.get("TELESCOP");
            fullName = "SWAP " + measurement;
        }
        else if (instrument.contains("GONG")) {
            instrument = "GONG";
            measurement = m.get("WAVELNTH");
            observatory = m.get("TELESCOP");
{'fraction_non_alphanumeric': 0.10348876216034887, 'fraction_numerical': 0.0030191211003019122, 'mean_word_length': 2.7175810473815463, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7490400', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1702, 'n_words': 400}