Exemple #1
0
        AtomItem CreateItemFromLink(string key, Uri url, bool withOrbits)
        {
            string identifier = key.Replace(".EOF", "");
            Match  match      = Regex.Match(identifier,
                                            @"^(?'mission'\w{3})_OPER_AUX_(?'type'\w{6})_(?'system'\w{4})_(?'proddate'\w{15})_V(?'startdate'\w{15})_(?'stopdate'\w{15})$");

            if (!match.Success)
            {
                return(null);
            }

            AtomItem item = new AtomItem(identifier, string.Format("{0} {1} {2} {3}", match.Groups["mission"].Value,
                                                                   match.Groups["type"].Value,
                                                                   match.Groups["startdate"].Value,
                                                                   match.Groups["stopdate"].Value),
                                         url,
                                         identifier,
                                         DateTimeOffset.ParseExact(match.Groups["proddate"].Value, "yyyyMMddTHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToUniversalTime());

            DateTime start = DateTime.ParseExact(match.Groups["startdate"].Value, "yyyyMMddTHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToUniversalTime();
            DateTime stop  = DateTime.ParseExact(match.Groups["stopdate"].Value, "yyyyMMddTHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToUniversalTime();

            item.Identifier  = identifier;
            item.PublishDate = DateTimeOffset.ParseExact(match.Groups["proddate"].Value, "yyyyMMddTHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToUniversalTime();
            item.Links.Add(SyndicationLink.CreateMediaEnclosureLink(url, "application/xml", 0));
            item.ElementExtensions.Add("polygon", "http://www.georss.org/georss", "-90 -180 -90 180 90 180 90 -180 -90 -180");
            item.ElementExtensions.Add("date", "http://purl.org/dc/elements/1.1/", string.Format("{0}/{1}", start.ToString("O"), stop.ToString("O")));

            Terradue.ServiceModel.Ogc.Eop21.EarthObservationType eo = OrbToEo(identifier, match.Groups["mission"].Value, match.Groups["type"].Value, start, stop, item.PublishDate);
            if (eo != null)
            {
                log.DebugFormat("EOP extension created from {0}", url);
                item.ElementExtensions.Add(eo.CreateReader());
            }

            if (withOrbits)
            {
                var request = HttpWebRequest.Create(url);

                using (var response = request.GetResponse())
                {
                    Terradue.OpenSearch.Sentinel.Data.Earth_Explorer_File eefile = (Terradue.OpenSearch.Sentinel.Data.Earth_Explorer_File)eeser.Deserialize(response.GetResponseStream());
                    item.ElementExtensions.Add(GenerateOrbitsExtension(eefile));
                }
            }

            return(item);
        }
Exemple #2
0
        public static Terradue.Metadata.EarthObservation.Model.orbitListType GetS1OrbitsFromEE(Terradue.OpenSearch.Sentinel.Data.Earth_Explorer_File file)
        {
            Terradue.Metadata.EarthObservation.Model.orbitListType orbits = new Terradue.Metadata.EarthObservation.Model.orbitListType();

            orbits.orbit = file.Data_Block.List_of_OSVs.OSV.
                           Select <Terradue.OpenSearch.Sentinel.Data.Earth_Explorer_FileData_BlockList_of_OSVsOSV, Terradue.Metadata.EarthObservation.Model.orbitType>(o =>
            {
                Terradue.Metadata.EarthObservation.Model.orbitType orbit = new Terradue.Metadata.EarthObservation.Model.orbitType();
                orbit.time          = DateTime.SpecifyKind(DateTime.Parse(o.UTC.Replace("UTC=", "")), DateTimeKind.Utc);
                orbit.frame         = Terradue.Metadata.EarthObservation.Model.referenceFrameType.EarthFixed;
                orbit.absoluteOrbit = int.Parse(o.Absolute_Orbit.Replace("+", ""));
                orbit.position      = new double[] { o.X.Value, o.Y.Value, o.Z.Value };
                orbit.velocity      = new double[] { o.VX.Value, o.VY.Value, o.VZ.Value };
                return(orbit);
            }).ToArray();

            return(orbits);
        }
Exemple #3
0
        public static SyndicationElementExtension GenerateOrbitsExtension(Terradue.OpenSearch.Sentinel.Data.Earth_Explorer_File file)
        {
            SyndicationElementExtension extension = new SyndicationElementExtension(GetS1OrbitsFromEE(file), Terradue.Metadata.EarthObservation.Model.orbitListType.OrbitsSerializer);

            return(extension);
        }