Skip to content

Commit da8cdfc

Browse files
committed
s3 syn l2
1 parent 2f73197 commit da8cdfc

File tree

4 files changed

+120
-15
lines changed

4 files changed

+120
-15
lines changed

src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
DATASET_AWSUS_DEM,
4646
DATASET_CDAS_DEM,
4747
DATASET_CDAS_S3OLCIL2,
48+
DATASET_CDAS_S3SYNERGYL2,
4849
} from './layer/dataset';
4950
import { WmsLayer } from './layer/WmsLayer';
5051
import { WmtsLayer } from './layer/WmtsLayer';
@@ -143,6 +144,7 @@ import {
143144
import { ProcessingPayload } from './layer/processing';
144145
import { StatisticalApi } from './statistics/StatisticalApi';
145146
import { Fis } from './statistics/Fis';
147+
import { S3SYNL2CDASLayer } from './layer/S3SYNL2CDASLayer';
146148

147149
registerInitialAxiosInterceptors();
148150

@@ -160,6 +162,7 @@ export {
160162
DATASET_S3OLCI,
161163
DATASET_CDAS_S3OLCI,
162164
DATASET_CDAS_S3OLCIL2,
165+
DATASET_CDAS_S3SYNERGYL2,
163166
DATASET_S5PL2,
164167
DATASET_CDAS_S5PL2,
165168
DATASET_AWS_L8L1C,
@@ -190,6 +193,7 @@ export {
190193
S3OLCILayer,
191194
S3OLCICDASLayer,
192195
S3OLCIL2CDASLayer,
196+
S3SYNL2CDASLayer,
193197
S5PL2Layer,
194198
S5PL2CDASLayer,
195199
MODISLayer,

src/layer/LayersFactory.ts

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
DATASET_CDAS_OTC_S3OLCIL2,
5151
DATASET_CDAS_OTC_S5PL2,
5252
DATASET_CDAS_OTC_DEM,
53+
DATASET_CDAS_S3SYNERGYL2,
5354
} from './dataset';
5455
import { AbstractLayer } from './AbstractLayer';
5556
import { WmsLayer } from './WmsLayer';
@@ -86,6 +87,7 @@ import { S3SLSTRCDASLayer } from './S3SLSTRCDASLayer';
8687
import { S5PL2CDASLayer } from './S5PL2CDASLayer';
8788
import { WmsWmtMsLayer } from './WmsWmtMsLayer';
8889
import { S3OLCIL2CDASLayer } from './S3OLCIL2CDASLayer';
90+
import { S3SYNL2CDASLayer } from './S3SYNL2CDASLayer';
8991
export class LayersFactory {
9092
/*
9193
This class is responsible for creating the Layer subclasses from the limited information (like
@@ -111,6 +113,7 @@ export class LayersFactory {
111113
DATASET_CDAS_OTC_S3OLCI,
112114
DATASET_CDAS_S3OLCIL2,
113115
DATASET_CDAS_OTC_S3OLCIL2,
116+
DATASET_CDAS_S3SYNERGYL2,
114117
DATASET_S5PL2,
115118
DATASET_CDAS_S5PL2,
116119
DATASET_CDAS_OTC_S5PL2,
@@ -147,6 +150,7 @@ export class LayersFactory {
147150
[DATASET_CDAS_S3OLCI.id]: S3OLCICDASLayer,
148151
[DATASET_CDAS_OTC_S3OLCI.id]: S3OLCICDASLayer,
149152
[DATASET_CDAS_S3OLCIL2.id]: S3OLCIL2CDASLayer,
153+
[DATASET_CDAS_S3SYNERGYL2.id]: S3SYNL2CDASLayer,
150154
[DATASET_CDAS_OTC_S3OLCIL2.id]: S3OLCIL2CDASLayer,
151155
[DATASET_S5PL2.id]: S5PL2Layer,
152156
[DATASET_CDAS_S5PL2.id]: S5PL2CDASLayer,

src/layer/S3SYNL2CDASLayer.ts

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import moment from 'moment';
2+
3+
import { DATASET_CDAS_S3SYNERGYL2 } from './dataset';
4+
import { AbstractSentinelHubV3WithCCLayer } from './AbstractSentinelHubV3WithCCLayer';
5+
import { RequestConfiguration } from '../utils/cancelRequests';
6+
7+
import { PaginatedTiles, Link, LinkType, FindTilesAdditionalParameters } from './const';
8+
9+
type S3SYNL2FindTilesDatasetParameters = {
10+
type?: string;
11+
};
12+
13+
export class S3SYNL2CDASLayer extends AbstractSentinelHubV3WithCCLayer {
14+
public readonly dataset = DATASET_CDAS_S3SYNERGYL2;
15+
16+
protected convertResponseFromSearchIndex(response: {
17+
data: { tiles: any[]; hasMore: boolean };
18+
}): PaginatedTiles {
19+
return {
20+
tiles: response.data.tiles.map((tile) => ({
21+
geometry: tile.dataGeometry,
22+
sensingTime: moment.utc(tile.sensingTime).toDate(),
23+
meta: this.extractFindTilesMeta(tile),
24+
links: this.getTileLinks(tile),
25+
})),
26+
hasMore: response.data.hasMore,
27+
};
28+
}
29+
30+
protected getFindTilesAdditionalParameters(): FindTilesAdditionalParameters {
31+
const findTilesDatasetParameters: S3SYNL2FindTilesDatasetParameters = {
32+
type: this.dataset.shProcessingApiDatasourceAbbreviation,
33+
};
34+
35+
return {
36+
maxCloudCoverPercent: this.maxCloudCoverPercent,
37+
datasetParameters: findTilesDatasetParameters,
38+
};
39+
}
40+
41+
protected async getFindDatesUTCAdditionalParameters(
42+
reqConfig: RequestConfiguration, // eslint-disable-line @typescript-eslint/no-unused-vars
43+
): Promise<Record<string, any>> {
44+
const result: Record<string, any> = {
45+
datasetParameters: {
46+
type: this.dataset.datasetParametersType,
47+
},
48+
};
49+
50+
if (this.maxCloudCoverPercent !== null) {
51+
result.maxCloudCoverage = this.maxCloudCoverPercent / 100;
52+
}
53+
54+
return result;
55+
}
56+
57+
protected getTileLinks(tile: Record<string, any>): Link[] {
58+
return [
59+
{
60+
target: tile.originalId.replace('EODATA', '/eodata'),
61+
type: LinkType.CREODIAS,
62+
},
63+
{
64+
target: `https://finder.creodias.eu/files${tile.originalId.replace(
65+
'EODATA',
66+
'',
67+
)}/${tile.productName.replace('.SEN3', '')}-ql.jpg`,
68+
type: LinkType.PREVIEW,
69+
},
70+
];
71+
}
72+
73+
protected getTileLinksFromCatalog(feature: Record<string, any>): Link[] {
74+
const { assets } = feature;
75+
let result: Link[] = super.getTileLinksFromCatalog(feature);
76+
77+
if (assets.data && assets.data.href) {
78+
result.push({ target: assets.data.href.replace('s3://DIAS', '/dias'), type: LinkType.CREODIAS });
79+
}
80+
return result;
81+
}
82+
}

src/layer/dataset.ts

+30-15
Original file line numberDiff line numberDiff line change
@@ -223,21 +223,6 @@ export const DATASET_CDAS_S3OLCI: Dataset = {
223223
catalogCollectionId: 'sentinel-3-olci',
224224
};
225225

226-
export const DATASET_CDAS_OTC_S3OLCI: Dataset = {
227-
id: 'CDAS_S3OLCI',
228-
shJsonGetCapabilitiesDataset: 'S3OLCI',
229-
shWmsEvalsource: 'S3OLCI',
230-
shProcessingApiDatasourceAbbreviation: 'S3OLCI',
231-
datasetParametersType: 'S3',
232-
shServiceHostname: 'https://sh-otc.dataspace.copernicus.eu/',
233-
searchIndexUrl: 'https://sh-otc.dataspace.copernicus.eu/index/v3/collections/S3OLCI/searchIndex',
234-
findDatesUTCUrl: 'https://sh-otc.dataspace.copernicus.eu/index/v3/collections/S3OLCI/findAvailableData',
235-
orbitTimeMinutes: 50.495,
236-
minDate: new Date(Date.UTC(2016, 4 - 1, 25, 11, 33, 14)), // 2016-04-25T11:33:14
237-
maxDate: null,
238-
catalogCollectionId: 'sentinel-3-olci',
239-
};
240-
241226
export const DATASET_CDAS_S3OLCIL2: Dataset = {
242227
id: 'CDAS_S3OLCIL2',
243228
shJsonGetCapabilitiesDataset: 'S3OLCIL2',
@@ -253,6 +238,36 @@ export const DATASET_CDAS_S3OLCIL2: Dataset = {
253238
catalogCollectionId: 'sentinel-3-olci-l2',
254239
};
255240

241+
export const DATASET_CDAS_S3SYNERGYL2: Dataset = {
242+
id: 'CDAS_S3SYNL2',
243+
shJsonGetCapabilitiesDataset: 'S3SYNL2',
244+
shWmsEvalsource: 'sentinel-3-synergy-l2',
245+
shProcessingApiDatasourceAbbreviation: 'sentinel-3-synergy-l2',
246+
datasetParametersType: 'S3',
247+
shServiceHostname: 'https://sh.dataspace.copernicus.eu/',
248+
searchIndexUrl: 'https://sh.dataspace.copernicus.eu/index/v3/collections/S3SYNL2/searchIndex',
249+
findDatesUTCUrl: 'https://sh.dataspace.copernicus.eu/index/v3/collections/S3SYNL2/findAvailableData',
250+
orbitTimeMinutes: 50.495,
251+
minDate: new Date(Date.UTC(2016, 4 - 1, 25, 11, 33, 14)), // 2016-04-25T11:33:14
252+
maxDate: null,
253+
catalogCollectionId: 'sentinel-3-synergy-l2',
254+
};
255+
256+
export const DATASET_CDAS_OTC_S3OLCI: Dataset = {
257+
id: 'CDAS_S3OLCI',
258+
shJsonGetCapabilitiesDataset: 'S3OLCI',
259+
shWmsEvalsource: 'S3OLCI',
260+
shProcessingApiDatasourceAbbreviation: 'S3OLCI',
261+
datasetParametersType: 'S3',
262+
shServiceHostname: 'https://sh-otc.dataspace.copernicus.eu/',
263+
searchIndexUrl: 'https://sh-otc.dataspace.copernicus.eu/index/v3/collections/S3OLCI/searchIndex',
264+
findDatesUTCUrl: 'https://sh-otc.dataspace.copernicus.eu/index/v3/collections/S3OLCI/findAvailableData',
265+
orbitTimeMinutes: 50.495,
266+
minDate: new Date(Date.UTC(2016, 4 - 1, 25, 11, 33, 14)), // 2016-04-25T11:33:14
267+
maxDate: null,
268+
catalogCollectionId: 'sentinel-3-olci',
269+
};
270+
256271
export const DATASET_CDAS_OTC_S3OLCIL2: Dataset = {
257272
id: 'CDAS_S3OLCIL2',
258273
shJsonGetCapabilitiesDataset: 'S3OLCIL2',

0 commit comments

Comments
 (0)