Granule.java 8.82 KB
/*
 * This file is a part of EpnTAPClient.
 * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer.
 * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861
 * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie.
 *
 * This program is free software: you can
 * redistribute it and/or modify it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
 * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE. See the GNU General Public License for more details. You should have received a copy of
 * the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */

package eu.omp.irap.vespa.epntapclient.granule;

import java.util.Date;

/**
 * @author N. Jourdane
 */
public class Granule {

	/** Internal table row index. Unique ID in data service, also in v2. Can be alphanum. */
	public String granuleUid;

	/**
	 * Common to granules of same type (e.g. same map projection, or geometry data products). Can be
	 * alphanum.
	 */
	public String granuleGid;

	/**
	 * Associates granules derived from the same data (e.g. various representations / processing
	 * levels). Can be alphanum., may be the ID of original observation.
	 */
	public String obsId;

	/** Organization of the data product, from enumerated list. */
	public String dataproductType;

	/** Standard IAU name of target (from a list related to target class), case sensitive. */
	public String targetName;

	/** Type of target, from enumerated list. */
	public String targetClass;

	/**
	 * Acquisition start time (in JD). UTC measured at time_origin location (default is observer's
	 * frame)
	 */
	public Double timeMin;

	/**
	 * Acquisition stop time (in JD). UTC measured at time_origin location (default is observer's
	 * frame).
	 */
	public Double timeMax;

	/** Min time sampling step. */
	public Double timeSamplingStepMin;

	/** Max time sampling step. */
	public Double timeSamplingStepMax;

	/** Min integration time. */
	public Double timeExpMin;

	/** Max integration time. */
	public Double timeExpMax;

	/** Min spectral range (frequency). */
	public Double spectralRangeMin;

	/** Max spectral range (frequency). */
	public Double spectralRangeMax;

	/** Min spectral sampling step. */
	public Double spectralSamplingStepMin;

	/** Max spectral sampling step. */
	public Double spectralSamplingStepMax;

	/** Min spectral resolution. */
	public Double spectralResolutionMin;

	/** Max spectral resolution. */
	public Double spectralResolutionMax;

	/** Min of first coordinate. */
	public Double c1Min;

	/** Max of first coordinate. */
	public Double c1Max;

	/** Min of second coordinate. */
	public Double c2Min;

	/** Max of second coordinate. */
	public Double c2Max;

	/** Min of third coordinate. */
	public Double c3Min;

	/** Max of third coordinate. */
	public Double c3Max;

	/** ObsCore-like footprint, assume spatial_coordinate_description. */
	public String sRegion;

	/** Min resolution in first coordinate. */
	public Double c1ResolMin;

	/** Max resolution in first coordinate. */
	public Double c1ResolMax;

	/** Min resolution in second coordinate. */
	public Double c2ResolMin;

	/** Max resolution in second coordinate. */
	public Double c2ResolMax;

	/** Min resolution in third coordinate. */
	public Double c3ResolMin;

	/** Max resolution in third coordinate. */
	public Double c3ResolMax;

	/** Flavor of coordinate system, defines the nature of coordinates. From enumerated list. */
	public String spatialFrameType;

	/** Min incidence angle (solar zenithal angle). */
	public Double incidenceMin;

	/** Max incidence angle (solar zenithal angle). */
	public Double incidenceMax;

	/** Min emergence angle. */
	public Double emergenceMin;

	/** Max emergence angle. */
	public Double emergenceMax;

	/** Min phase angle. */
	public Double phaseMin;

	/** Max phase angle. */
	public Double phaseMax;

	/** Standard name of the observatory or spacecraft. */
	public String instrumentHostName;

	/** Standard name of instrument */
	public String instrumentName;

	/** UCD(s) defining the data */
	public String measurementType;

	/** CODMAC calibration level in v1 */
	public Integer processingLevel;

	/** Date of first entry of this granule */
	public Date creationDate;

	/** Date of last modification (used to handle mirroring) */
	public Date modificationDate;

	/**  */
	public Date releaseDate;

	/**  */
	public String serviceTitle;

	/**  */
	public String accessUrl;

	/**  */
	public String accessFormat;

	/** Estimate file size in kbyte (with this spelling) */
	public int accessEstsize;

	/**
	 * If access_format indicates a detached label, this parameter is mandatory and points to the
	 * corresponding data file - both will be handled by the client before samping it to tools or
	 * downloading
	 */
	public String dataAccessUrl;

	/** MD5 Hash for the file when available (real file) */
	public String accessMd5;

	/** URL of a thumbnail image with predefined size (png ~200 pix, for use in a client only) */
	public String thumbnailUrl;

	/** Name of the data file only, case sensitive */
	public String fileName;

	/** Identifies a chemical species, case sensitive */
	public String species;

	/** Provides alternative target name if more common (e.g. comets) */
	public String altTargetName;

	/**  */
	public String targetRegion;

	/**  */
	public String featureName;

	/** Bibcode, doi, or other biblio id, URL */
	public String bibReference;

	/**  */
	public double ra;

	/** Declination */
	public double dec;

	/** Min Solar longitude Ls (location on orbit / season) */
	public double solarLongitudeMin;

	/** Max Solar longitude Ls (location on orbit / season) */
	public double solarLongitudeMax;

	/** Local time at observed region */
	public double localTimeMin;

	/** Local time at observed region */
	public double localTimeMax;

	/** Observer-target distance */
	public double targetDistanceMin;

	/** Observer-target distance */
	public double targetDistanceMax;

	/**  */
	public double targetTimeMin;

	/**  */
	public double targetTimeMax;

	/**  */
	public String particleSpectralType;

	/**  */
	public double particleSpectralRangeMin;

	/**  */
	public double particleSpectralRangeMax;

	/**  */
	public double particleSpectralSamplingStepMin;

	/**  */
	public double particleSpectralSamplingStepMax;

	/**  */
	public double particleSpectralResolutionMin;

	/**  */
	public double particleSpectralResolutionMax;

	/** Resource publisher */
	public String publisher;

	/** ID of specific coordinate system and version */
	public String spatialCoordinateDescription;

	/** Defines the frame origin */
	public String spatialOrigin;

	/**  */
	public String timeOrigin;

	/**  */
	public String timeScale;


	/** Private constructor to hide the default public one. */
	private Granule() {
	}

	/**
	 * Constructor of Granule
	 *
	 * @param granuleUid The granule identifier.
	 */
	public Granule(String granuleUid) {
		this.granuleUid = granuleUid;
	}

	/**
	 * A granule is valid if all mandatory parameters are filled.
	 *
	 * @return true if the Granule is valid, false otherwise.
	 */
	public boolean isValid() {
		boolean valid = granuleUid != null && granuleGid != null && obsId != null;
		valid = valid && dataproductType != null && targetName != null && targetClass != null;
		valid = valid && timeMin != null && timeMax != null;
		valid = valid && timeSamplingStepMin != null && timeSamplingStepMax != null;
		valid = valid && timeExpMin != null && timeExpMax != null;
		valid = valid && spectralRangeMin != null && spectralRangeMax != null;
		valid = valid && timeSamplingStepMin != null && timeSamplingStepMax != null;
		valid = valid && spectralResolutionMin != null && spectralResolutionMax != null;
		valid = valid && c1Min != null && c1Max != null;
		valid = valid && c2Min != null && c2Max != null;
		valid = valid && c3Min != null && c3Max != null;
		valid = valid && sRegion != null;
		valid = valid && c1ResolMin != null && c1ResolMax != null;
		valid = valid && c2ResolMin != null && c2ResolMax != null;
		valid = valid && c3ResolMin != null && c3ResolMax != null;
		valid = valid && spatialFrameType != null;
		valid = valid && incidenceMin != null && incidenceMax != null;
		valid = valid && emergenceMin != null && emergenceMax != null;
		valid = valid && phaseMin != null && phaseMax != null;
		valid = valid && instrumentHostName != null && instrumentName != null;
		valid = valid && measurementType != null && processingLevel != null;
		valid = valid && creationDate != null && modificationDate != null;
		valid = valid && releaseDate != null && serviceTitle != null;

		return valid;
	}

	@Override
	public String toString() {
		return granuleUid;
	}

}