sentinel_s3 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +20 -19
- data/lib/sentinel_s3/client.rb +4 -1
- data/lib/sentinel_s3/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dcf715921eb262f59ab9b2018506776dfa28de0469174b24af50c81825fd430
|
4
|
+
data.tar.gz: df4a06a3d046297a4f1354f3d3650e004690f57ade1b86ae126b381eef723f57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b01a631285218b82335b3bd0a664bedc9df34e74bc1f9fe43df2aa5c055d704039490ef09a823395954f687c77a9ad7dbf7f8e041d570c935486e608c0c3385
|
7
|
+
data.tar.gz: f715843f88cc017843437c5b1b463f14bda98ebce16c03f59543c6eca20199522bf74fe7880f6689a18eac6a69893946cd07143d4f83079a92304eea2981069f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[gem]: https://rubygems.org/gems/sentinel_s3
|
6
6
|
|
7
7
|
Ruby library for extracting Sentinel-2 tile metadata and downloading tile data from [Amazon S3](https://aws.amazon.com/public-datasets/sentinel-2/).
|
8
|
-
This
|
8
|
+
This is the primary mechanism for retrieving data for the [Sentinel-2 S3 Search API](https://github.com/beaorn/s2) project.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -30,9 +30,9 @@ Initialize SentinelS3::Client
|
|
30
30
|
client = SentinelS3::Client.new("access_key_id", "secret_access_key")
|
31
31
|
```
|
32
32
|
|
33
|
-
Get productInfo.json object paths for all products by date
|
33
|
+
Get productInfo.json object paths for all products by date: `get_products("YYYY-MM-DD")`
|
34
34
|
```ruby
|
35
|
-
products = client.get_products("2017-12-14")
|
35
|
+
products = client.get_products("2017-12-14")
|
36
36
|
# =>
|
37
37
|
# [
|
38
38
|
# "products/2017/12/14/S2B_MSIL1C_20171214T230119_N0206_R015_T58FCD_20171214T234716/productInfo.json",
|
@@ -43,33 +43,34 @@ products = client.get_products("2017-12-14") # YYYY-MM-DD
|
|
43
43
|
Get product and tile metadata
|
44
44
|
```ruby
|
45
45
|
# takes single productInfo.json path returned from get_products
|
46
|
-
product = "products/2017/12/15/
|
46
|
+
product = "products/2017/12/15/S2B_MSIL1C_20171215T235729_N0206_R030_T57MVR_20171216T010047/productInfo.json"
|
47
47
|
metadata = client.get_product_info(product)
|
48
48
|
# =>
|
49
49
|
{
|
50
|
-
:name=>"S2B_MSIL1C_20171215T235729_N0206_R030_T57MVR_20171216T010047",
|
51
|
-
:id=>"eaedcad9-f287-41b8-944c-0cfed0b15db8",
|
52
|
-
:path=>
|
53
|
-
:timestamp=>"2017-12-15T23:57:29.027Z",
|
54
|
-
:datatake_identifier=>"GS2B_20171215T235729_004060_N02.06",
|
55
|
-
:scihub_ingestion=>"2017-12-16T01:46:29.112Z",
|
56
|
-
:s3_ingestion=>"2017-12-16T01:50:49.375Z",
|
50
|
+
:name => "S2B_MSIL1C_20171215T235729_N0206_R030_T57MVR_20171216T010047",
|
51
|
+
:id => "eaedcad9-f287-41b8-944c-0cfed0b15db8",
|
52
|
+
:path => "products/2017/12/15/S2B_MSIL1C_20171215T235729_N0206_R030_T57MVR_20171216T010047",
|
53
|
+
:timestamp => "2017-12-15T23:57:29.027Z",
|
54
|
+
:datatake_identifier => "GS2B_20171215T235729_004060_N02.06",
|
55
|
+
:scihub_ingestion => "2017-12-16T01:46:29.112Z",
|
56
|
+
:s3_ingestion => "2017-12-16T01:50:49.375Z",
|
57
57
|
:tiles=>
|
58
58
|
[
|
59
59
|
{
|
60
|
-
:path=>"tiles/57/M/VR/2017/12/15/0",
|
61
|
-
:timestamp=>"2017-12-15T23:57:27.460Z",
|
62
|
-
:utm_zone=>57,
|
63
|
-
:latitude_band=>"M",
|
64
|
-
:grid_square=>"VR",
|
65
|
-
:
|
66
|
-
:
|
60
|
+
:path => "tiles/57/M/VR/2017/12/15/0",
|
61
|
+
:timestamp => "2017-12-15T23:57:27.460Z",
|
62
|
+
:utm_zone => 57,
|
63
|
+
:latitude_band => "M",
|
64
|
+
:grid_square => "VR",
|
65
|
+
:epsg => "32757",
|
66
|
+
:data_coverage_percentage => 31.21,
|
67
|
+
:cloudy_pixel_percentage => 13.47
|
67
68
|
}
|
68
69
|
]
|
69
70
|
}
|
70
71
|
```
|
71
72
|
|
72
|
-
Download tile data `download_tile_data(s3 tile path, file, output path)`
|
73
|
+
Download tile data: `download_tile_data(s3 tile path, file, output path)`
|
73
74
|
```ruby
|
74
75
|
client.download_tile_data("tiles/57/M/VR/2017/12/15/0", "B01.jp2", "/path/that/exists")
|
75
76
|
```
|
data/lib/sentinel_s3/client.rb
CHANGED
@@ -14,7 +14,7 @@ module SentinelS3
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def parse_date(date)
|
17
|
-
y, m, d = date.split
|
17
|
+
y, m, d = date.split('-')
|
18
18
|
y, m, d = y.to_i, m.to_i, d.to_i
|
19
19
|
if Date.valid_date? y, m, d
|
20
20
|
return [y, m, d]
|
@@ -67,12 +67,15 @@ module SentinelS3
|
|
67
67
|
tile_info = Oj.load(tile_file)
|
68
68
|
FileUtils.remove_entry(tile_filepath)
|
69
69
|
|
70
|
+
epsg_str = tile_info["tileGeometry"]["crs"]["properties"]["name"].split(':')
|
71
|
+
|
70
72
|
tile_metadata = {
|
71
73
|
path: tile_info["path"],
|
72
74
|
timestamp: tile_info["timestamp"],
|
73
75
|
utm_zone: tile_info["utmZone"],
|
74
76
|
latitude_band: tile_info["latitudeBand"],
|
75
77
|
grid_square: tile_info["gridSquare"],
|
78
|
+
epsg: epsg_str[-1],
|
76
79
|
data_coverage_percentage: tile_info["dataCoveragePercentage"],
|
77
80
|
cloudy_pixel_percentage: tile_info["cloudyPixelPercentage"]
|
78
81
|
}
|
data/lib/sentinel_s3/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentinel_s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Johnston
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|