Skip to content

Commit dffe38f

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

File tree

4 files changed

+122
-15
lines changed

4 files changed

+122
-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

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

src/layer/dataset.ts

+31-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,37 @@ 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+
console.log('TEEEST');
256+
257+
export const DATASET_CDAS_OTC_S3OLCI: Dataset = {
258+
id: 'CDAS_S3OLCI',
259+
shJsonGetCapabilitiesDataset: 'S3OLCI',
260+
shWmsEvalsource: 'S3OLCI',
261+
shProcessingApiDatasourceAbbreviation: 'S3OLCI',
262+
datasetParametersType: 'S3',
263+
shServiceHostname: 'https://sh-otc.dataspace.copernicus.eu/',
264+
searchIndexUrl: 'https://sh-otc.dataspace.copernicus.eu/index/v3/collections/S3OLCI/searchIndex',
265+
findDatesUTCUrl: 'https://sh-otc.dataspace.copernicus.eu/index/v3/collections/S3OLCI/findAvailableData',
266+
orbitTimeMinutes: 50.495,
267+
minDate: new Date(Date.UTC(2016, 4 - 1, 25, 11, 33, 14)), // 2016-04-25T11:33:14
268+
maxDate: null,
269+
catalogCollectionId: 'sentinel-3-olci',
270+
};
271+
256272
export const DATASET_CDAS_OTC_S3OLCIL2: Dataset = {
257273
id: 'CDAS_S3OLCIL2',
258274
shJsonGetCapabilitiesDataset: 'S3OLCIL2',

0 commit comments

Comments
 (0)