stac 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +18 -0
- data/GETTING_STARTED.md +384 -0
- data/Gemfile.lock +48 -37
- data/README.md +16 -57
- data/Rakefile +62 -4
- data/Steepfile +2 -0
- data/lib/stac/asset.rb +7 -1
- data/lib/stac/catalog.rb +81 -9
- data/lib/stac/collection.rb +43 -9
- data/lib/stac/common_metadata.rb +162 -0
- data/lib/stac/errors.rb +2 -5
- data/lib/stac/extension.rb +34 -0
- data/lib/stac/extensions/electro_optical.rb +67 -0
- data/lib/stac/extensions/projection.rb +42 -0
- data/lib/stac/extensions/scientific_citation.rb +84 -0
- data/lib/stac/extensions/view_geometry.rb +38 -0
- data/lib/stac/extent.rb +39 -31
- data/lib/stac/file_writer.rb +31 -0
- data/lib/stac/hash_like.rb +74 -0
- data/lib/stac/item.rb +58 -22
- data/lib/stac/link.rb +50 -14
- data/lib/stac/object_resolver.rb +14 -20
- data/lib/stac/properties.rb +6 -1
- data/lib/stac/provider.rb +5 -1
- data/lib/stac/{default_http_client.rb → simple_http_client.rb} +9 -4
- data/lib/stac/stac_object.rb +142 -31
- data/lib/stac/version.rb +1 -1
- data/lib/stac.rb +18 -2
- data/sig/stac/asset.rbs +3 -3
- data/sig/stac/catalog.rbs +29 -5
- data/sig/stac/collection.rbs +13 -5
- data/sig/stac/common_metadata.rbs +34 -0
- data/sig/stac/errors.rbs +1 -4
- data/sig/stac/extension.rbs +12 -0
- data/sig/stac/extensions/electro_optical.rbs +40 -0
- data/sig/stac/extensions/projection.rbs +32 -0
- data/sig/stac/extensions/scientific_citation.rbs +38 -0
- data/sig/stac/extensions/view_geometry.rbs +22 -0
- data/sig/stac/extent.rbs +13 -16
- data/sig/stac/file_writer.rbs +13 -0
- data/sig/stac/hash_like.rbs +13 -0
- data/sig/stac/item.rbs +17 -7
- data/sig/stac/link.rbs +21 -12
- data/sig/stac/object_resolver.rbs +5 -9
- data/sig/stac/properties.rbs +3 -3
- data/sig/stac/provider.rbs +2 -3
- data/sig/stac/{default_http_client.rbs → simple_http_client.rbs} +5 -2
- data/sig/stac/stac_object.rbs +34 -11
- data/sig/stac.rbs +7 -1
- data/stac.gemspec +1 -1
- metadata +26 -9
@@ -1,23 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'json'
|
3
4
|
require 'open-uri'
|
4
5
|
require_relative 'errors'
|
5
6
|
require_relative 'version'
|
6
7
|
|
7
8
|
module STAC
|
9
|
+
# Raised when a HTTP request failed.
|
10
|
+
class HTTPError < Error; end
|
11
|
+
|
8
12
|
# Simple HTTP Client using OpenURI.
|
9
|
-
class
|
13
|
+
class SimpleHTTPClient
|
10
14
|
attr_reader :options
|
11
15
|
|
12
16
|
def initialize(options = { 'User-Agent' => "stac-ruby v#{VERSION}" })
|
13
17
|
@options = options
|
14
18
|
end
|
15
19
|
|
16
|
-
# Makes a HTTP request and returns the
|
20
|
+
# Makes a HTTP request and returns the responded JSON as Hash.
|
17
21
|
#
|
18
22
|
# Raises STAC::HTTPError when the response status is not 2XX.
|
19
|
-
def get(
|
20
|
-
|
23
|
+
def get(url)
|
24
|
+
body = URI(url).read(options)
|
25
|
+
JSON.parse(body)
|
21
26
|
rescue OpenURI::HTTPError => e
|
22
27
|
raise HTTPError, e.message
|
23
28
|
end
|
data/lib/stac/stac_object.rb
CHANGED
@@ -1,46 +1,67 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'json'
|
4
3
|
require_relative 'errors'
|
4
|
+
require_relative 'file_writer'
|
5
|
+
require_relative 'hash_like'
|
5
6
|
require_relative 'link'
|
6
7
|
require_relative 'spec_version'
|
7
8
|
|
8
9
|
module STAC
|
9
|
-
#
|
10
|
+
# Raised when a STAC object does not have rel="self" link HREF.
|
11
|
+
class NoSelfHrefError < Error
|
12
|
+
attr_reader :stac_object
|
13
|
+
|
14
|
+
def initialize(msg = nil, stac_object:)
|
15
|
+
super(msg)
|
16
|
+
@stac_object = stac_object
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Base class for \STAC objects (i.e. Catalog, Collection, and Item).
|
10
21
|
class STACObject
|
22
|
+
include HashLike
|
23
|
+
|
24
|
+
@@extendables = {} # rubocop:disable Style/ClassVars
|
25
|
+
|
26
|
+
# Returns available extension modules.
|
27
|
+
def self.extendables
|
28
|
+
@@extendables.values.uniq
|
29
|
+
end
|
30
|
+
|
31
|
+
# Adds the given extension module to .extendables.
|
32
|
+
def self.add_extendable(extendable)
|
33
|
+
@@extendables[extendable.identifier] = extendable
|
34
|
+
self
|
35
|
+
end
|
36
|
+
|
11
37
|
class << self
|
12
|
-
|
38
|
+
attr_reader :type # :nodoc:
|
13
39
|
|
14
40
|
# Base method to deserialize shared fields from a Hash.
|
15
41
|
#
|
16
42
|
# Raises ArgumentError when any required fields are missing.
|
17
43
|
def from_hash(hash)
|
18
|
-
|
44
|
+
h = hash.transform_keys(&:to_sym)
|
45
|
+
raise TypeError, "type field is not '#{type}': #{h[:type]}" if h.fetch(:type) != type
|
19
46
|
|
20
|
-
|
21
|
-
transformed[:links] = transformed.fetch(:links).map { |link| Link.from_hash(link) }
|
22
|
-
new(**transformed)
|
23
|
-
rescue KeyError => e
|
24
|
-
raise ArgumentError, "required field not found: #{e.key}"
|
47
|
+
new(**h.except(:type, :stac_version))
|
25
48
|
end
|
26
49
|
end
|
27
50
|
|
28
|
-
|
51
|
+
# HTTP Client to fetch objects from HTTP HREF links.
|
52
|
+
attr_accessor :http_client
|
29
53
|
|
30
|
-
attr_reader :links
|
54
|
+
attr_reader :stac_extensions, :links
|
31
55
|
|
32
|
-
def initialize(
|
33
|
-
@id = id
|
56
|
+
def initialize(links: [], stac_extensions: [], **extra)
|
34
57
|
@links = []
|
35
58
|
links.each do |link|
|
36
|
-
add_link(link) # to set `owner`
|
59
|
+
add_link(**link.transform_keys(&:to_sym)) # to set `owner`
|
37
60
|
end
|
38
61
|
@stac_extensions = stac_extensions
|
39
62
|
@extra = extra.transform_keys(&:to_s)
|
40
|
-
|
41
|
-
|
42
|
-
def type
|
43
|
-
self.class.type
|
63
|
+
@http_client = STAC.default_http_client
|
64
|
+
apply_extensions!
|
44
65
|
end
|
45
66
|
|
46
67
|
# Serializes self to a Hash.
|
@@ -48,21 +69,64 @@ module STAC
|
|
48
69
|
{
|
49
70
|
'type' => type,
|
50
71
|
'stac_version' => SPEC_VERSION,
|
51
|
-
'stac_extensions' => stac_extensions,
|
52
|
-
'id' => id,
|
72
|
+
'stac_extensions' => stac_extensions.empty? ? nil : stac_extensions,
|
53
73
|
'links' => links.map(&:to_h),
|
54
74
|
}.merge(extra).compact
|
55
75
|
end
|
56
76
|
|
57
|
-
|
58
|
-
|
59
|
-
|
77
|
+
def deep_dup
|
78
|
+
super.tap do |obj|
|
79
|
+
obj.http_client = http_client.dup
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def type
|
84
|
+
self.class.type.to_s
|
85
|
+
end
|
86
|
+
|
87
|
+
# Returns extended extension modules.
|
88
|
+
def extended
|
89
|
+
@extended ||= []
|
90
|
+
end
|
91
|
+
|
92
|
+
# Adds the given extension identifier to #stac_extensions.
|
93
|
+
#
|
94
|
+
# When the given argument is extendable, the item extends the module.
|
95
|
+
def add_extension(extension)
|
96
|
+
case extension
|
97
|
+
when Extension
|
98
|
+
stac_extensions << extension.identifier
|
99
|
+
apply_extension!(extension)
|
100
|
+
else
|
101
|
+
stac_extensions << extension
|
102
|
+
if (extension = @@extendables[extension]) && extension.scope.include?(self.class)
|
103
|
+
apply_extension!(extension)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
# Returns a link matching the arguments.
|
110
|
+
def find_link(rel:, type: nil)
|
111
|
+
links.find do |link|
|
112
|
+
if type
|
113
|
+
link.rel == rel && link.type == type
|
114
|
+
else
|
115
|
+
link.rel == rel
|
116
|
+
end
|
117
|
+
end
|
60
118
|
end
|
61
119
|
|
62
120
|
# Adds a link with setting Link#owner as self.
|
63
|
-
|
121
|
+
#
|
122
|
+
# Raises ArgumentError when both target and href are not given.
|
123
|
+
def add_link(target = nil, rel:, href: nil, type: nil, title: nil, **extra)
|
124
|
+
raise ArgumentError, 'target or href must be given' if target.nil? && href.nil?
|
125
|
+
|
126
|
+
link = Link.new(target, rel: rel, href: href, type: type, title: title, **extra)
|
64
127
|
link.owner = self
|
65
128
|
links << link
|
129
|
+
self
|
66
130
|
end
|
67
131
|
|
68
132
|
# Reterns HREF of the rel="self" link.
|
@@ -70,22 +134,69 @@ module STAC
|
|
70
134
|
find_link(rel: 'self')&.href
|
71
135
|
end
|
72
136
|
|
73
|
-
#
|
137
|
+
# Overwrites rel="self" link with the given HREF.
|
74
138
|
#
|
75
139
|
# When any ref="self" links already exist, removes them.
|
76
140
|
def self_href=(absolute_href)
|
77
|
-
|
78
|
-
|
79
|
-
|
141
|
+
remove_links(rel: 'self')
|
142
|
+
add_link(rel: 'self', href: absolute_href, type: 'application/json')
|
143
|
+
end
|
144
|
+
|
145
|
+
# Returns a rel="root" link as a catalog/collection object if it exists.
|
146
|
+
def root
|
147
|
+
find_link(rel: 'root')&.target
|
148
|
+
end
|
149
|
+
|
150
|
+
# Overwrites rel="root" link.
|
151
|
+
def root=(catalog)
|
152
|
+
remove_links(rel: 'root')
|
153
|
+
add_link(catalog, rel: 'root', type: 'application/json', title: catalog.title) if catalog
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns a rel="parent" link as a catalog/collection object if it exists.
|
157
|
+
def parent
|
158
|
+
find_link(rel: 'parent')&.target
|
159
|
+
end
|
160
|
+
|
161
|
+
# Overwrites rel="parent" link.
|
162
|
+
def parent=(catalog)
|
163
|
+
remove_links(rel: 'parent')
|
164
|
+
add_link(catalog, rel: 'parent', type: 'application/json', title: catalog.title) if catalog
|
165
|
+
end
|
166
|
+
|
167
|
+
# Writes self on `dest` with the given writer.
|
168
|
+
#
|
169
|
+
# The default writer is a FileWriter.
|
170
|
+
def save(dest = nil, writer: FileWriter.new)
|
171
|
+
writer.write(to_h, dest: dest || self_href!)
|
172
|
+
end
|
173
|
+
|
174
|
+
protected
|
175
|
+
|
176
|
+
def self_href!
|
177
|
+
self_href or raise NoSelfHrefError.new('no rel="self" link href', stac_object: self)
|
80
178
|
end
|
81
179
|
|
82
180
|
private
|
83
181
|
|
84
|
-
def
|
85
|
-
|
182
|
+
def extensions
|
183
|
+
stac_extensions
|
184
|
+
.map { |extension_id| @@extendables[extension_id] }
|
185
|
+
.compact
|
186
|
+
.select { |extension| extension.scope.include?(self.class) }
|
187
|
+
end
|
188
|
+
|
189
|
+
def apply_extensions!
|
190
|
+
extensions.each do |extension|
|
191
|
+
apply_extension!(extension)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def apply_extension!(extension)
|
196
|
+
extended << extension
|
86
197
|
end
|
87
198
|
|
88
|
-
def
|
199
|
+
def remove_links(rel:)
|
89
200
|
links.reject! { |link| link.rel == rel }
|
90
201
|
end
|
91
202
|
end
|
data/lib/stac/version.rb
CHANGED
data/lib/stac.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'stac/object_resolver'
|
4
|
+
require_relative 'stac/simple_http_client'
|
5
|
+
require_relative 'stac/stac_object'
|
6
|
+
require_relative 'stac/extensions/electro_optical'
|
7
|
+
require_relative 'stac/extensions/projection'
|
8
|
+
require_relative 'stac/extensions/scientific_citation'
|
9
|
+
require_relative 'stac/extensions/view_geometry'
|
4
10
|
require_relative 'stac/version'
|
5
11
|
|
6
12
|
# Gem namespace.
|
@@ -8,6 +14,8 @@ require_relative 'stac/version'
|
|
8
14
|
# Provides some utility methods.
|
9
15
|
module STAC
|
10
16
|
class << self
|
17
|
+
attr_accessor :default_http_client
|
18
|
+
|
11
19
|
# Returns a \STAC object resolved from the given file path.
|
12
20
|
def from_file(path)
|
13
21
|
from_url("file://#{File.expand_path(path)}")
|
@@ -16,10 +24,18 @@ module STAC
|
|
16
24
|
# Returns a \STAC object resolved from the given URL.
|
17
25
|
#
|
18
26
|
# When the resolved object does not have rel="self" link, adds a rel="self" link with the give url.
|
19
|
-
def from_url(url,
|
20
|
-
object =
|
27
|
+
def from_url(url, http_client: default_http_client)
|
28
|
+
object = ObjectResolver.new(http_client: http_client).resolve(url)
|
21
29
|
object.self_href = url unless object.self_href
|
22
30
|
object
|
23
31
|
end
|
24
32
|
end
|
33
|
+
|
34
|
+
self.default_http_client = SimpleHTTPClient.new
|
35
|
+
|
36
|
+
STACObject
|
37
|
+
.add_extendable(Extensions::ElectroOptical)
|
38
|
+
.add_extendable(Extensions::Projection)
|
39
|
+
.add_extendable(Extensions::ScientificCitation)
|
40
|
+
.add_extendable(Extensions::ViewGeometry)
|
25
41
|
end
|
data/sig/stac/asset.rbs
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module STAC
|
2
2
|
class Asset
|
3
|
+
include HashLike
|
4
|
+
include CommonMetadata
|
5
|
+
|
3
6
|
def self.from_hash: (Hash[String, untyped] hash) -> Asset
|
4
7
|
|
5
8
|
attr_accessor href: String
|
@@ -7,12 +10,9 @@ module STAC
|
|
7
10
|
attr_accessor description: String?
|
8
11
|
attr_accessor type: String?
|
9
12
|
attr_accessor roles: Array[String]?
|
10
|
-
attr_accessor extra: Hash[String, untyped]
|
11
13
|
|
12
14
|
def initialize: (
|
13
15
|
href: String, ?title: String?, ?description: String?, ?type: String?, ?roles: Array[String]?, **untyped
|
14
16
|
) -> void
|
15
|
-
|
16
|
-
def to_h: -> Hash[String, untyped]
|
17
17
|
end
|
18
18
|
end
|
data/sig/stac/catalog.rbs
CHANGED
@@ -1,20 +1,44 @@
|
|
1
1
|
module STAC
|
2
2
|
class Catalog < STACObject
|
3
|
-
def self.from_hash: (Hash[String, untyped] hash) -> Catalog
|
3
|
+
def self.from_hash: (Hash[String | Symbol, untyped] hash) -> Catalog
|
4
|
+
def self.root: (
|
5
|
+
id: String,
|
6
|
+
description: String,
|
7
|
+
href: String,
|
8
|
+
?links: Array[Hash[String, String]],
|
9
|
+
?title: String?,
|
10
|
+
?stac_extensions: Array[String],
|
11
|
+
**untyped
|
12
|
+
) -> Catalog
|
4
13
|
|
14
|
+
attr_accessor id: String
|
5
15
|
attr_accessor description: String
|
6
16
|
attr_accessor title: String?
|
7
17
|
|
8
18
|
def initialize: (
|
9
|
-
id: String,
|
19
|
+
id: String,
|
20
|
+
description: String,
|
21
|
+
?links: Array[Hash[String, String]],
|
22
|
+
?title: String?,
|
23
|
+
?stac_extensions: Array[String],
|
24
|
+
**untyped
|
10
25
|
) -> void
|
11
26
|
|
12
|
-
def
|
13
|
-
def
|
27
|
+
def children: -> Enumerator::Lazy[Catalog, void]
|
28
|
+
def all_children: -> Enumerator::Lazy[Catalog, void]
|
14
29
|
def collections: -> Enumerator::Lazy[Collection, void]
|
15
|
-
def
|
30
|
+
def all_collections: -> Enumerator::Lazy[Collection, void]
|
31
|
+
def find_child: (String id, ?recursive: bool) -> Catalog?
|
16
32
|
def items: -> Enumerator::Lazy[Item, void]
|
17
33
|
def all_items: -> Enumerator::Lazy[Item, void]
|
18
34
|
def find_item: (String id, ?recursive: bool) -> Item?
|
35
|
+
def add_child: (Catalog catalog, ?href: String, ?title: String?) -> self
|
36
|
+
def add_item: (Item item, ?href: String, ?title: String?) -> self
|
37
|
+
def export: (?String? dest_dir, ?writer: _Writer) -> void
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def child_links: -> Array[Link]
|
42
|
+
def item_links: -> Array[Link]
|
19
43
|
end
|
20
44
|
end
|
data/sig/stac/collection.rbs
CHANGED
@@ -1,29 +1,37 @@
|
|
1
1
|
module STAC
|
2
2
|
class Collection < Catalog
|
3
|
-
def self.from_hash: (Hash[String, untyped] hash) -> Collection
|
3
|
+
def self.from_hash: (Hash[String | Symbol, untyped] hash) -> Collection
|
4
4
|
|
5
5
|
attr_accessor license: String
|
6
6
|
attr_accessor extent: Extent
|
7
7
|
attr_accessor keywords: Array[String]?
|
8
8
|
attr_accessor providers: Array[Provider]?
|
9
9
|
attr_accessor summaries: Hash[String, untyped]?
|
10
|
-
|
10
|
+
attr_reader assets: Hash[String, Asset]?
|
11
11
|
|
12
12
|
def initialize: (
|
13
13
|
id: String,
|
14
14
|
description: String,
|
15
|
-
links: Array[Link],
|
16
15
|
license: String,
|
17
16
|
extent: Extent,
|
17
|
+
?links: Array[Hash[String, String]],
|
18
18
|
?title: String?,
|
19
19
|
?keywords: Array[String]?,
|
20
20
|
?providers: Array[Provider]?,
|
21
21
|
?summaries: Hash[String, untyped]?,
|
22
22
|
?assets: Hash[String, Asset]?,
|
23
|
-
?stac_extensions: Array[String]
|
23
|
+
?stac_extensions: Array[String],
|
24
24
|
**untyped
|
25
25
|
) -> void
|
26
26
|
|
27
|
-
def
|
27
|
+
def add_asset: (
|
28
|
+
key: String,
|
29
|
+
href: String,
|
30
|
+
?title: String?,
|
31
|
+
?description: String?,
|
32
|
+
?type: String?,
|
33
|
+
?roles: Array[String]?,
|
34
|
+
**untyped
|
35
|
+
) -> self
|
28
36
|
end
|
29
37
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module STAC
|
2
|
+
module CommonMetadata
|
3
|
+
attr_reader extra: Hash[String, untyped]
|
4
|
+
|
5
|
+
def title: -> String?
|
6
|
+
def title=: (String) -> void
|
7
|
+
def description: -> String?
|
8
|
+
def description=: (String) -> void
|
9
|
+
def created: -> Time?
|
10
|
+
def created=: (Time | String) -> void
|
11
|
+
def updated: -> Time?
|
12
|
+
def updated=: (Time | String) -> void
|
13
|
+
def start_datetime: -> Time?
|
14
|
+
def start_datetime=: (Time | String) -> void
|
15
|
+
def end_datetime: -> Time?
|
16
|
+
def end_datetime=: (Time | String) -> void
|
17
|
+
def datetime_range: -> Range[Time]?
|
18
|
+
def datetime_range=: (Range[Time]) -> void
|
19
|
+
def license: -> String?
|
20
|
+
def license=: (String) -> void
|
21
|
+
def providers: -> Array[Provider]
|
22
|
+
def providers=: (Array[Provider | Hash[String, untyped]]) -> void
|
23
|
+
def platform: -> String?
|
24
|
+
def platform=: (String) -> void
|
25
|
+
def instruments: -> Array[String]?
|
26
|
+
def instruments=: (Array[String]) -> void
|
27
|
+
def constellation: -> String?
|
28
|
+
def constellation=: (String) -> void
|
29
|
+
def mission: -> String?
|
30
|
+
def mission=: (String) -> void
|
31
|
+
def gsd: -> Numeric
|
32
|
+
def gsd=: (Numeric) -> void
|
33
|
+
end
|
34
|
+
end
|
data/sig/stac/errors.rbs
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
module STAC
|
2
|
+
module Extensions
|
3
|
+
module ElectroOptical
|
4
|
+
extend Extension
|
5
|
+
|
6
|
+
module Properties
|
7
|
+
attr_reader extra: Hash[String, untyped]
|
8
|
+
|
9
|
+
def eo_bands: -> Array[Band]
|
10
|
+
def eo_bands=: (Array[Hash[String, untyped] | Band]) -> void
|
11
|
+
def eo_cloud_cover: -> Numeric?
|
12
|
+
def eo_cloud_cover=: (Numeric) -> void
|
13
|
+
end
|
14
|
+
|
15
|
+
module Asset
|
16
|
+
include Properties
|
17
|
+
end
|
18
|
+
|
19
|
+
class Band
|
20
|
+
attr_reader raw_hash: Hash[String, untyped]
|
21
|
+
|
22
|
+
def initialize: (Hash[String, untyped] raw_hash) -> void
|
23
|
+
|
24
|
+
def to_h: -> Hash[String, untyped]
|
25
|
+
def name: -> String?
|
26
|
+
def name=: (String) -> void
|
27
|
+
def common_name: -> String?
|
28
|
+
def common_name=: (String) -> void
|
29
|
+
def description: -> String?
|
30
|
+
def description=: (String) -> void
|
31
|
+
def center_wavelength: -> Numeric?
|
32
|
+
def center_wavelength=: (Numeric) -> void
|
33
|
+
def full_width_half_max: -> Numeric?
|
34
|
+
def full_width_half_max=: (Numeric) -> void
|
35
|
+
def solar_illumination: -> Numeric?
|
36
|
+
def solar_illumination=: (Numeric) -> void
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module STAC
|
2
|
+
module Extensions
|
3
|
+
module Projection
|
4
|
+
extend Extension
|
5
|
+
|
6
|
+
module Properties
|
7
|
+
attr_reader extra: Hash[String, untyped]
|
8
|
+
|
9
|
+
def proj_epsg: -> Numeric?
|
10
|
+
def proj_epsg=: (Numeric) -> void
|
11
|
+
def proj_wkt2: -> String?
|
12
|
+
def proj_wkt2=: (String) -> void
|
13
|
+
def proj_projjson: -> Hash[String, untyped]?
|
14
|
+
def proj_projjson=: (Hash[String, untyped]) -> void
|
15
|
+
def proj_geometry: -> Hash[String, untyped]?
|
16
|
+
def proj_geometry=: (Hash[String, untyped]) -> void
|
17
|
+
def proj_bbox: -> Array[Numeric]?
|
18
|
+
def proj_bbox=: (Array[Numeric]) -> void
|
19
|
+
def proj_centroid: -> {'lat' => Numeric, 'lon' => Numeric}?
|
20
|
+
def proj_centroid=: ({'lat' => Numeric, 'lon' => Numeric}) -> void
|
21
|
+
def proj_shape: -> Array[Integer]?
|
22
|
+
def proj_shape=: (Array[Integer]) -> void
|
23
|
+
def proj_transform: -> Array[Numeric]?
|
24
|
+
def proj_transform=: (Array[Numeric]) -> void
|
25
|
+
end
|
26
|
+
|
27
|
+
module Asset
|
28
|
+
include Properties
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module STAC
|
2
|
+
module Extensions
|
3
|
+
module ScientificCitation
|
4
|
+
extend Extension
|
5
|
+
|
6
|
+
module Properties
|
7
|
+
attr_reader extra: Hash[String, untyped]
|
8
|
+
|
9
|
+
def sci_doi: -> String?
|
10
|
+
def sci_doi=: (String) -> void
|
11
|
+
def sci_citation: -> String?
|
12
|
+
def sci_citation=: (String) -> void
|
13
|
+
def sci_publications: -> Array[Publication]
|
14
|
+
def sci_publications=: (Array[Hash[String, String] | Publication]) -> void
|
15
|
+
end
|
16
|
+
|
17
|
+
module Asset
|
18
|
+
include Properties
|
19
|
+
end
|
20
|
+
|
21
|
+
module Collection
|
22
|
+
include Properties
|
23
|
+
end
|
24
|
+
|
25
|
+
class Publication
|
26
|
+
attr_reader raw_hash: Hash[String, String]
|
27
|
+
|
28
|
+
def initialize: (Hash[String, String] raw_hash) -> void
|
29
|
+
|
30
|
+
def to_h: -> Hash[String, String]
|
31
|
+
def doi: -> String?
|
32
|
+
def doi=: (String) -> void
|
33
|
+
def citation: -> String?
|
34
|
+
def citation=: (String) -> void
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module STAC
|
2
|
+
module Extensions
|
3
|
+
module ViewGeometry
|
4
|
+
extend Extension
|
5
|
+
|
6
|
+
module Properties
|
7
|
+
attr_reader extra: Hash[String, untyped]
|
8
|
+
|
9
|
+
def view_off_nadir: -> Numeric?
|
10
|
+
def view_off_nadir=: (Numeric) -> void
|
11
|
+
def view_incidence_angle: -> Numeric?
|
12
|
+
def view_incidence_angle=: (Numeric) -> void
|
13
|
+
def view_azimuth: -> Numeric?
|
14
|
+
def view_azimuth=: (Numeric) -> void
|
15
|
+
def view_sun_azimuth: -> Numeric?
|
16
|
+
def view_sun_azimuth=: (Numeric) -> void
|
17
|
+
def view_sun_elevation: -> Numeric?
|
18
|
+
def view_sun_elevation=: (Numeric) -> void
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/sig/stac/extent.rbs
CHANGED
@@ -1,35 +1,32 @@
|
|
1
1
|
module STAC
|
2
2
|
class Extent
|
3
|
+
include HashLike
|
4
|
+
|
5
|
+
def self.from_hash: (Hash[String, untyped] hash) -> Extent
|
6
|
+
|
7
|
+
attr_accessor spatial: Spatial
|
8
|
+
attr_accessor temporal: Temporal
|
9
|
+
|
10
|
+
def initialize: (spatial: Spatial, temporal: Temporal, **untyped) -> void
|
11
|
+
|
3
12
|
class Spatial
|
13
|
+
include HashLike
|
14
|
+
|
4
15
|
def self.from_hash: (Hash[String, untyped] hash) -> Spatial
|
5
16
|
|
6
17
|
attr_accessor bbox: Array[Array[Numeric]]
|
7
|
-
attr_accessor extra: Hash[String, untyped]
|
8
18
|
|
9
19
|
def initialize: (bbox: Array[Array[Numeric]], **untyped) -> void
|
10
|
-
|
11
|
-
def to_h: -> Hash[String, untyped]
|
12
20
|
end
|
13
21
|
|
14
22
|
class Temporal
|
23
|
+
include HashLike
|
24
|
+
|
15
25
|
def self.from_hash: (Hash[String, untyped] hash) -> Temporal
|
16
26
|
|
17
27
|
attr_accessor interval: Array[Array[String?]]
|
18
|
-
attr_accessor extra: Hash[String, untyped]
|
19
28
|
|
20
29
|
def initialize: (interval: Array[Array[String?]], **untyped) -> void
|
21
|
-
|
22
|
-
def to_h: -> Hash[String, untyped]
|
23
30
|
end
|
24
|
-
|
25
|
-
def self.from_hash: (Hash[String, untyped] hash) -> Extent
|
26
|
-
|
27
|
-
attr_accessor spatial: Spatial
|
28
|
-
attr_accessor temporal: Temporal
|
29
|
-
attr_accessor extra: Hash[String, untyped]
|
30
|
-
|
31
|
-
def initialize: (spatial: Spatial, temporal: Temporal, **untyped) -> void
|
32
|
-
|
33
|
-
def to_h: -> Hash[String, untyped]
|
34
31
|
end
|
35
32
|
end
|