Skip to content

Commit

Permalink
some initial work on sat extension
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Sep 6, 2020
1 parent 22377e7 commit 649e87a
Show file tree
Hide file tree
Showing 24 changed files with 1,402 additions and 46 deletions.
43 changes: 27 additions & 16 deletions notebooks/example.ipynb

Large diffs are not rendered by default.

27 changes: 23 additions & 4 deletions src/DotNetStac.Test/Examples/Example1Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,38 @@ namespace Stac.Test.Example
{
public class Example1Test
{
// [Fact]
[Fact]
public void Deserialize()
{
IStacCatalog catalog = (IStacCatalog)StacFactory.Load("https://cbers-stac-0-7.s3.amazonaws.com/CBERS4/MUX/027/069/catalog.json");
IStacCatalog catalog = (IStacCatalog)StacFactory.Load("https://cbers-stac-0-7.s3.amazonaws.com/CBERS4/MUX/027/catalog.json");

Console.Out.WriteLine(catalog.Id);
Console.Out.WriteLine(catalog.StacVersion);

foreach (var item in catalog.GetItems().Values)
ListChildrensItemsAndAssets(catalog);

}

public static void ListChildrensItemsAndAssets(IStacCatalog catalog, string prefix = "")
{
foreach (var child in catalog.GetChildren().Values)
{
Console.Out.WriteLine(item.Id);
Console.Out.WriteLine(prefix + child.Id);

foreach (var item in child.GetItems().Values)
{
Console.Out.WriteLine(prefix + " " + item.Id);
foreach (var asset in item.Assets.Values)
{
Console.Out.WriteLine(prefix + " *" + asset.Uri);
}
}

ListChildrensItemsAndAssets(child, prefix + " ");
}
}


[Fact]
public void CanSerializeSentinel2Sample()
{
Expand Down Expand Up @@ -178,5 +196,6 @@ public void CanSerializeSentinel2Sample()

}


}
}
34 changes: 34 additions & 0 deletions src/DotNetStac.Test/Item/SatExtensionTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Stac.Extensions.Sat;
using GeoJSON.Net;
using GeoJSON.Net.Geometry;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Stac.Item;
using Xunit;

namespace Stac.Test.Item
{
public class SatExtensionTests : TestBase
{
[Fact]
public void CalculatePerpendicularBaseline()
{
var sentinel1Json_1 = GetExpectedJson("Item", "S1A_IW_SLC__1SDV_20150305T051937_20150305T052005_004892_006196_ABBB");
var sentinel1Json_2 = GetExpectedJson("Item", "S1A_IW_SLC__1SDV_20150317T051938_20150317T052005_005067_0065D5_B405");

IStacItem sentinel1Item_1 = JsonConvert.DeserializeObject<StacItem>(sentinel1Json_1);
IStacItem sentinel1Item_2 = JsonConvert.DeserializeObject<StacItem>(sentinel1Json_2);

SatStacExtension satExtension_1 = sentinel1Item_1.GetExtension<SatStacExtension>();
SatStacExtension satExtension_2 = sentinel1Item_2.GetExtension<SatStacExtension>();

double baseline = satExtension_1.CalculateBaseline(satExtension_2);


}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"stac_version": "1.0.0-beta.2",
"stac_extensions": [
"checksum",
"sar",
"sat"
],
"id": "S1A_IW_SLC__1SDV_20150305T051937_20150305T052005_004892_006196_ABBB",
"type": "Feature",
"bbox": [
9.768469,
40.479584,
13.182633,
42.516747
],
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
12.756503,
40.479584
],
[
9.768469,
40.877575
],
[
10.115331,
42.516747
],
[
13.182633,
42.119347
],
[
12.756503,
40.479584
]
]
]
},
"properties": {
"datetime": null,
"start_datetime": "2015-03-05T05:19:37.9237880Z",
"end_datetime": "2015-03-05T05:20:05.2359650Z",
"platform": "sentinel-1a",
"constellation": "sentinel-1",
"instruments": [
"c-sar"
],
"sat:orbit_state": "descending",
"sat:relative_orbit": 95,
"sar:instrument_mode": "IW",
"sar:polarizations": [
"VV",
"VH"
],
"sar:swaths": [
"IW1",
"IW2",
"IW3"
],
"sar:resolution_range": 3.5,
"sar:resolution_azimuth": 22,
"sar:pixel_spacing_range": 2.3,
"sar:pixel_spacing_azimuth": 14.1,
"sar:looks_range": 1,
"sar:looks_azimuth": 1,
"sar:looks_equivalent_number": 1,
"sar:frequency_band": "C",
"sar:center_frequency": 5.405,
"sar:product_type": "SLC",
"sat:orbit_state_vectors": [
{
"time": "2015-03-05T05:19:40.103Z",
"position": [
5082939.4189831074,
1595651.7369050409,
4648033.5588545678
],
"velocity": [
5173.8779329387489,
-269.5432365485845,
-5550.246440359806
]
},
{
"time": "2015-03-05T05:19:45.449Z",
"position": [
5110519.0376543682,
1594174.328112772,
4618284.7202579351
],
"velocity": [
5143.1200754073143,
-283.12343661734587,
-5578.2160610647188
]
},
{
"time": "2015-03-05T05:19:50.449Z",
"position": [
5136162.3887853986,
1592727.024757518,
4590328.5904560406
],
"velocity": [
5114.1961953273549,
-295.79384304587683,
-5604.2108611458289
]
},
{
"time": "2015-03-05T05:19:55.924Z",
"position": [
5164072.5441757264,
1591069.8320865589,
4559571.316048217
],
"velocity": [
5082.3526507991337,
-309.63210108985578,
-5632.4913494303792
]
},
{
"time": "2015-03-05T05:20:00.765Z",
"position": [
5188609.7603185736,
1589541.212127296,
4532241.9604941187
],
"velocity": [
5054.0385357467367,
-321.84144931789291,
-5657.3419096395919
]
},
{
"time": "2015-03-05T05:20:05.765Z",
"position": [
5213806.5408000136,
1587900.5449101711,
4503891.4133093376
],
"velocity": [
5024.6493178792934,
-334.42045595717849,
-5682.8512214013936
]
}
],
"sat:absolute_orbit": 4892
},
"assets": {
"noises_iw1_vh": {
"href": "./annotation/calibration/noise-s1a-iw1-slc-vh-20150305t051939-20150305t052005-004892-006196-001.xml",
"title": "Calibration Schema",
"type": "text/xml",
"sar:polarizations": [
"VH"
],
"sar:swath": [
"IW1"
]
},
"calibrations_iw1_vh": {
"href": "./annotation/calibration/calibration-s1a-iw1-slc-vh-20150305t051939-20150305t052005-004892-006196-001.xml",
"title": "Noise Schema",
"type": "text/xml",
"sar:polarizations": [
"VH"
],
"sar:swath": [
"IW1"
]
},
"products_iw1_vh": {
"href": "./annotation/s1a-iw1-slc-vh-20150305t051939-20150305t052005-004892-006196-001.xml",
"title": "Product Schema",
"type": "text/xml",
"sar:polarizations": [
"VH"
],
"sar:swath": [
"IW1"
]
},
"measurement_iw1_vh": {
"href": "./measurement/s1a-iw1-slc-vh-20150305t051939-20150305t052005-004892-006196-001.tiff",
"title": "Measurements",
"type": "image/tiff",
"sar:polarizations": [
"VH"
],
"sar:swath": [
"IW1"
]
},
"thumbnail": {
"href": "./preview/quick-look.png",
"title": "Thumbnail",
"type": "image/png"
}
},
"links": [
{
"rel": "self",
"href": "https://example.com/collections/sentinel-1/items/S1A_EW_GRDM_1SSH_20181103T235855_20181103T235955_024430_02AD5D_5616"
},
{
"rel": "parent",
"href": "https://example.com/collections/sentinel-1"
},
{
"rel": "root",
"href": "https://example.com/collections"
}
]
}
Loading

0 comments on commit 649e87a

Please sign in to comment.