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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbc5433bf2015598e89031948bb98aa53884880bf68481ca8375fd61f595a47c
4
- data.tar.gz: 00db77b48db11a9b0836e695e26014d96ea918e3364ae3c94ee18f16fb936cdb
3
+ metadata.gz: 2dcf715921eb262f59ab9b2018506776dfa28de0469174b24af50c81825fd430
4
+ data.tar.gz: df4a06a3d046297a4f1354f3d3650e004690f57ade1b86ae126b381eef723f57
5
5
  SHA512:
6
- metadata.gz: a2bd2e22d0c38becfad49b50590cec299793a1a1a167f9c1ffd0edb2ef086c1014e8cd9ce5fae4f96eb6e3a25f1fbe33b2de81e4429a386b016f914f63839b76
7
- data.tar.gz: da97183db1507f808a73742e7e06855ec1ae900bb7af1405e8ee47108ca480a3c9fb89945072221a9e3c35b0b9425ebcd3803d22f9e71f665ac04119f13295f6
6
+ metadata.gz: 3b01a631285218b82335b3bd0a664bedc9df34e74bc1f9fe43df2aa5c055d704039490ef09a823395954f687c77a9ad7dbf7f8e041d570c935486e608c0c3385
7
+ data.tar.gz: f715843f88cc017843437c5b1b463f14bda98ebce16c03f59543c6eca20199522bf74fe7880f6689a18eac6a69893946cd07143d4f83079a92304eea2981069f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sentinel_s3 (0.2.0)
4
+ sentinel_s3 (0.2.1)
5
5
  aws-sdk (~> 3)
6
6
  oj (< 4)
7
7
 
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 was created to be the primary mechanism for inserting data into the [Sentinel-2 S3 Search API](https://github.com/beaorn/s2) project.
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") # YYYY-MM-DD
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/S2B_MSIL1C_20171215T235729_N0206_R030_T57MVR_20171216T010047productInfo.json"
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=> "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",
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
- :data_coverage_percentage=>31.21,
66
- :cloudy_pixel_percentage=>13.47
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
  ```
@@ -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
  }
@@ -1,3 +1,3 @@
1
1
  module SentinelS3
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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-16 00:00:00.000000000 Z
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj