timesteps 0.9.6 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/{LICENSES → LICENSE} +0 -0
- data/NEWS.md +8 -0
- data/Note.ja.md +9 -0
- data/README.md +15 -7
- data/lib/timesteps/datetime_parse_timestamp.rb +21 -12
- data/lib/timesteps/datetime_timestep.rb +64 -0
- data/lib/timesteps/datetimelike.rb +6 -17
- data/lib/timesteps/grads.rb +39 -18
- data/lib/timesteps/time.rb +14 -0
- data/lib/timesteps/timeperiod.rb +50 -47
- data/lib/timesteps/timestep.rb +480 -248
- data/lib/timesteps/timestep_calendar.rb +49 -29
- data/lib/timesteps/timestep_converter.rb +19 -22
- data/lib/timesteps/timestep_datetime_ext.rb +6 -16
- data/lib/timesteps/timestep_pair.rb +37 -24
- data/lib/timesteps/timestep_query.rb +12 -4
- data/lib/timesteps/timestep_range.rb +155 -0
- data/lib/timesteps.rb +4 -0
- data/spec/allleap_spec.rb +4 -15
- data/spec/fixed360day_spec.rb +4 -15
- data/spec/noleap_spec.rb +2 -13
- data/spec/timestep_spec.rb +4 -27
- data/timesteps.gemspec +3 -3
- metadata +9 -4
data/spec/noleap_spec.rb
CHANGED
@@ -121,17 +121,6 @@ describe "NoLeap.parse_timestamp" do
|
|
121
121
|
|
122
122
|
end
|
123
123
|
|
124
|
-
example "with bc option" do
|
125
|
-
|
126
|
-
d1 = DateTime::NoLeap.new(0, 1, 1, 0, 0, 0, 0)
|
127
|
-
d2 = DateTime.parse_timestamp('BC 0001-1-1 00:00:00', calendar: "noleap")
|
128
|
-
d3 = DateTime.parse_timestamp('-0001-1-1 00:00:00', calendar: "noleap", bc: true)
|
129
|
-
|
130
|
-
is_asserted_by { d2 == d1 }
|
131
|
-
is_asserted_by { d3 == d1 }
|
132
|
-
|
133
|
-
end
|
134
|
-
|
135
124
|
example '2000-12-31 24:00:00' do
|
136
125
|
|
137
126
|
d1 = DateTime::NoLeap.new(2001, 1, 1, 0, 0, 0, 0)
|
@@ -300,8 +289,8 @@ describe "NoLeap#difference_in_years" do
|
|
300
289
|
d3 = DateTime::NoLeap.new(2002, 3, 5, 9, 35, 11.5, 9.quo(24))
|
301
290
|
d4 = DateTime::NoLeap.new(2002, 3, 5, 9, 35, 12.5, 9.quo(24))
|
302
291
|
|
303
|
-
is_asserted_by { d2.difference_in_years(d1) ==
|
304
|
-
is_asserted_by { d3.difference_in_years(d1) ==
|
292
|
+
is_asserted_by { d2.difference_in_years(d1) == 1.quo(2) }
|
293
|
+
is_asserted_by { d3.difference_in_years(d1) == 1.quo(2) }
|
305
294
|
is_asserted_by { d4.difference_in_years(d1) == 1 }
|
306
295
|
|
307
296
|
end
|
data/spec/timestep_spec.rb
CHANGED
@@ -319,10 +319,10 @@ describe "TimeStep#index_at" do
|
|
319
319
|
is_asserted_by { ts.index_at( ts.origin.next_year(100) ) == 100 }
|
320
320
|
is_asserted_by { ts.index_at( ts.origin.prev_year(1) ) == -1 }
|
321
321
|
is_asserted_by { ts.index_at( ts.origin.prev_year(100) ) == -100 }
|
322
|
-
is_asserted_by { ts.index_at( ts.origin.next_year(1) - 1 ) == 0 }
|
323
|
-
is_asserted_by { ts.index_at( ts.origin.next_year(100) - 1 ) == 99 }
|
324
|
-
is_asserted_by { ts.index_at( ts.origin.prev_year(1) + 1 ) ==
|
325
|
-
is_asserted_by { ts.index_at( ts.origin.prev_year(100) + 1 ) == -
|
322
|
+
is_asserted_by { ts.index_at( ts.origin.next_year(1) - 1 ).floor == 0 }
|
323
|
+
is_asserted_by { ts.index_at( ts.origin.next_year(100) - 1 ).floor == 99 }
|
324
|
+
is_asserted_by { ts.index_at( ts.origin.prev_year(1) + 1 ).floor == -1 }
|
325
|
+
is_asserted_by { ts.index_at( ts.origin.prev_year(100) + 1 ).floor == -100 }
|
326
326
|
|
327
327
|
end
|
328
328
|
|
@@ -436,26 +436,3 @@ describe "TimeStep#new_origin" do
|
|
436
436
|
|
437
437
|
end
|
438
438
|
|
439
|
-
describe "TimeStep#limit" do
|
440
|
-
|
441
|
-
example do
|
442
|
-
|
443
|
-
CALENDAR_NAMES.each do |calendar|
|
444
|
-
|
445
|
-
ts = TimeStep.new("1 hours since 2001-02-03 04:05:06 +07:00", calendar: calendar, count: 31)
|
446
|
-
is_asserted_by { ts.limit == ts.time_at(30) }
|
447
|
-
|
448
|
-
ts = TimeStep.new("1 hours since 2001-02-03 04:05:06 +07:00", calendar: calendar)
|
449
|
-
ts.count = 31
|
450
|
-
is_asserted_by { ts.limit == ts.time_at(30) }
|
451
|
-
|
452
|
-
ts = TimeStep.new("1 hours since 2001-02-03 04:05:06 +07:00", calendar: calendar)
|
453
|
-
ts.limit = ts.time_at(30)
|
454
|
-
is_asserted_by { ts.count == 31 }
|
455
|
-
|
456
|
-
end
|
457
|
-
|
458
|
-
end
|
459
|
-
|
460
|
-
end
|
461
|
-
|
data/timesteps.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
Gem::Specification::new do |s|
|
3
|
-
version = "0.
|
3
|
+
version = "1.0.1"
|
4
4
|
|
5
|
-
files = Dir.glob("**/*") - [
|
5
|
+
files = Dir.glob("**/*") + [".yardopts"] - [
|
6
6
|
Dir.glob("timesteps-*.gem"),
|
7
7
|
Dir.glob("doc/**/*"),
|
8
8
|
Dir.glob("examples/**/*"),
|
@@ -20,7 +20,7 @@ Gem::Specification::new do |s|
|
|
20
20
|
describe the time axis when dealing with time series of observational data and climate data.
|
21
21
|
HERE
|
22
22
|
s.version = version
|
23
|
-
s.
|
23
|
+
s.license = 'MIT'
|
24
24
|
s.author = "Hiroki Motoyoshi"
|
25
25
|
s.email = ""
|
26
26
|
s.homepage = 'https://github.com/himotoyoshi/timesteps'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timesteps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Motoyoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: " A library for time conversion and intercomparison of multiple time
|
14
14
|
series data \n in the case of handling time series data of the type that specifies
|
@@ -22,7 +22,9 @@ executables: []
|
|
22
22
|
extensions: []
|
23
23
|
extra_rdoc_files: []
|
24
24
|
files:
|
25
|
-
-
|
25
|
+
- ".yardopts"
|
26
|
+
- LICENSE
|
27
|
+
- NEWS.md
|
26
28
|
- Note.ja.md
|
27
29
|
- README.md
|
28
30
|
- Rakefile
|
@@ -31,9 +33,11 @@ files:
|
|
31
33
|
- lib/timesteps/datetime_allleap.rb
|
32
34
|
- lib/timesteps/datetime_noleap.rb
|
33
35
|
- lib/timesteps/datetime_parse_timestamp.rb
|
36
|
+
- lib/timesteps/datetime_timestep.rb
|
34
37
|
- lib/timesteps/datetimelike.rb
|
35
38
|
- lib/timesteps/datetimelike_format.rb
|
36
39
|
- lib/timesteps/grads.rb
|
40
|
+
- lib/timesteps/time.rb
|
37
41
|
- lib/timesteps/timeperiod.rb
|
38
42
|
- lib/timesteps/timestep.rb
|
39
43
|
- lib/timesteps/timestep_calendar.rb
|
@@ -41,6 +45,7 @@ files:
|
|
41
45
|
- lib/timesteps/timestep_datetime_ext.rb
|
42
46
|
- lib/timesteps/timestep_pair.rb
|
43
47
|
- lib/timesteps/timestep_query.rb
|
48
|
+
- lib/timesteps/timestep_range.rb
|
44
49
|
- spec/allleap_spec.rb
|
45
50
|
- spec/fixed360day_spec.rb
|
46
51
|
- spec/noleap_spec.rb
|
@@ -66,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
71
|
- !ruby/object:Gem::Version
|
67
72
|
version: '0'
|
68
73
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
74
|
+
rubygems_version: 3.1.2
|
70
75
|
signing_key:
|
71
76
|
specification_version: 4
|
72
77
|
summary: A library for handling discrete time series in constant increments
|