sentinel_s3 0.1.0 → 0.2.0

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: 0e3cc3021c3641852c74d82cf41a52039a926d9ffdc231a79302b943ca03f358
4
- data.tar.gz: c4a54f86fffb30f5a7bb785a513d2eb772546a1902d1a408d1e00014ffdf0476
3
+ metadata.gz: bbc5433bf2015598e89031948bb98aa53884880bf68481ca8375fd61f595a47c
4
+ data.tar.gz: 00db77b48db11a9b0836e695e26014d96ea918e3364ae3c94ee18f16fb936cdb
5
5
  SHA512:
6
- metadata.gz: '02383bf5ad4787139f67ed1be4aa1ca997ca029ad52c3cb6cf5aeab88a90d777dfc71fd3786820f22ca893beaefdf7fed1b8e9832ee47a0700aa4a3128f6b302'
7
- data.tar.gz: 42ba12b4bbf017702cef574b807d5ceb3eaf12fd715f634d0af08071aee5653ab6e34ac5a95301a0780759bd17ef7da99d13b89c8326024e82cfb8acad215dbf
6
+ metadata.gz: a2bd2e22d0c38becfad49b50590cec299793a1a1a167f9c1ffd0edb2ef086c1014e8cd9ce5fae4f96eb6e3a25f1fbe33b2de81e4429a386b016f914f63839b76
7
+ data.tar.gz: da97183db1507f808a73742e7e06855ec1ae900bb7af1405e8ee47108ca480a3c9fb89945072221a9e3c35b0b9425ebcd3803d22f9e71f665ac04119f13295f6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sentinel_s3 (0.1.0)
4
+ sentinel_s3 (0.2.0)
5
5
  aws-sdk (~> 3)
6
6
  oj (< 4)
7
7
 
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # sentinel_s3
2
2
 
3
- Ruby library for extracting Sentinel-2 tile metadata from [Amazon S3](https://aws.amazon.com/public-datasets/sentinel-2/).
3
+ [![Gem Version](http://img.shields.io/gem/v/sentinel_s3.svg)][gem]
4
+
5
+ [gem]: https://rubygems.org/gems/sentinel_s3
6
+
7
+ Ruby library for extracting Sentinel-2 tile metadata and downloading tile data from [Amazon S3](https://aws.amazon.com/public-datasets/sentinel-2/).
4
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.
5
9
 
6
10
  ## Installation
@@ -65,6 +69,11 @@ metadata = client.get_product_info(product)
65
69
  }
66
70
  ```
67
71
 
72
+ Download tile data `download_tile_data(s3 tile path, file, output path)`
73
+ ```ruby
74
+ client.download_tile_data("tiles/57/M/VR/2017/12/15/0", "B01.jp2", "/path/that/exists")
75
+ ```
76
+
68
77
  ## Development
69
78
 
70
79
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -106,6 +106,18 @@ module SentinelS3
106
106
  end
107
107
  end
108
108
 
109
+ def download_tile_data(tile_path, filename, output_path)
110
+ s3_file = "#{tile_path}/#{filename}"
111
+ if @s3_resource.bucket(S3_BUCKET).object(s3_file).exists?
112
+ filepath = "#{output_path}/#{filename}"
113
+ obj = @s3_resource.bucket(S3_BUCKET).object(s3_file)
114
+ obj.get(response_target: filepath)
115
+ return filepath
116
+ else
117
+ return nil
118
+ end
119
+ end
120
+
109
121
  def remove_directory
110
122
  FileUtils.remove_dir(@directory)
111
123
  end
@@ -1,3 +1,3 @@
1
1
  module SentinelS3
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/sentinel_s3.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Bryce Johnston"]
10
10
  spec.email = ["bryce@agdeveloper.com"]
11
11
 
12
- spec.summary = %q{Sentinel-2 metadata crawler and extractor from Amazon S3}
13
- spec.description = %q{Sentinel-2 metadata crawler and extractor from Amazon S3}
12
+ spec.summary = %q{Sentinel-2 metadata extractor and tile data downloader from Amazon S3}
13
+ spec.description = %q{Sentinel-2 metadata extractor and tile data downloader from Amazon S3}
14
14
  spec.homepage = "https://github.com/beaorn/sentinel_s3"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentinel_s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryce Johnston
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
- description: Sentinel-2 metadata crawler and extractor from Amazon S3
83
+ description: Sentinel-2 metadata extractor and tile data downloader from Amazon S3
84
84
  email:
85
85
  - bryce@agdeveloper.com
86
86
  executables: []
@@ -124,5 +124,5 @@ rubyforge_project:
124
124
  rubygems_version: 2.7.3
125
125
  signing_key:
126
126
  specification_version: 4
127
- summary: Sentinel-2 metadata crawler and extractor from Amazon S3
127
+ summary: Sentinel-2 metadata extractor and tile data downloader from Amazon S3
128
128
  test_files: []