cdss-ruby 0.1.0
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 +7 -0
- data/.rubocop.yml +86 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/README.md +101 -0
- data/Rakefile +26 -0
- data/docs/Cdss/AdminCalls.html +399 -0
- data/docs/Cdss/Analysis.html +972 -0
- data/docs/Cdss/Client.html +581 -0
- data/docs/Cdss/Climate.html +1257 -0
- data/docs/Cdss/Concerns/LogReadingAttributes.html +406 -0
- data/docs/Cdss/Concerns/WellReadingAttributes.html +414 -0
- data/docs/Cdss/Concerns.html +117 -0
- data/docs/Cdss/GroundWater.html +945 -0
- data/docs/Cdss/Models/AdminCall.html +252 -0
- data/docs/Cdss/Models/Analysis.html +397 -0
- data/docs/Cdss/Models/CallAnalysis.html +140 -0
- data/docs/Cdss/Models/ClimateStation.html +249 -0
- data/docs/Cdss/Models/DiversionRecord.html +248 -0
- data/docs/Cdss/Models/Reading.html +301 -0
- data/docs/Cdss/Models/ReferenceTable.html +339 -0
- data/docs/Cdss/Models/RouteAnalysis.html +140 -0
- data/docs/Cdss/Models/SourceRoute.html +140 -0
- data/docs/Cdss/Models/Station.html +248 -0
- data/docs/Cdss/Models/Structure.html +259 -0
- data/docs/Cdss/Models/WaterClass.html +249 -0
- data/docs/Cdss/Models/WaterRight.html +255 -0
- data/docs/Cdss/Models/Well.html +251 -0
- data/docs/Cdss/Models.html +117 -0
- data/docs/Cdss/Parser.html +2155 -0
- data/docs/Cdss/Parsers/AdminCallsParser.html +201 -0
- data/docs/Cdss/Parsers/AnalysisParser.html +296 -0
- data/docs/Cdss/Parsers/BaseParser.html +207 -0
- data/docs/Cdss/Parsers/ClimateParser.html +253 -0
- data/docs/Cdss/Parsers/ReadingParser.html +201 -0
- data/docs/Cdss/Parsers/ReferenceTablesParser.html +201 -0
- data/docs/Cdss/Parsers/StationParser.html +201 -0
- data/docs/Cdss/Parsers/StructuresParser.html +305 -0
- data/docs/Cdss/Parsers/WaterRightsParser.html +219 -0
- data/docs/Cdss/Parsers/WellParser.html +357 -0
- data/docs/Cdss/Parsers.html +117 -0
- data/docs/Cdss/ReferenceTables.html +332 -0
- data/docs/Cdss/Structures.html +1132 -0
- data/docs/Cdss/SurfaceWater.html +798 -0
- data/docs/Cdss/Telemetry.html +763 -0
- data/docs/Cdss/Utils.html +1276 -0
- data/docs/Cdss/WaterRights.html +634 -0
- data/docs/Cdss.html +292 -0
- data/docs/_index.html +493 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +503 -0
- data/docs/file.README.html +108 -0
- data/docs/file_list.html +59 -0
- data/docs/frames.html +22 -0
- data/docs/index.html +108 -0
- data/docs/js/app.js +344 -0
- data/docs/js/full_list.js +242 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +790 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/cdss/admin_calls.rb +44 -0
- data/lib/cdss/analysis.rb +183 -0
- data/lib/cdss/client.rb +121 -0
- data/lib/cdss/climate.rb +155 -0
- data/lib/cdss/concerns/log_reading_attributes.rb +48 -0
- data/lib/cdss/concerns/well_reading_attributes.rb +56 -0
- data/lib/cdss/ground_water.rb +112 -0
- data/lib/cdss/models/admin_call.rb +45 -0
- data/lib/cdss/models/analysis.rb +77 -0
- data/lib/cdss/models/climate_station.rb +40 -0
- data/lib/cdss/models/reading.rb +54 -0
- data/lib/cdss/models/reference_table.rb +56 -0
- data/lib/cdss/models/station.rb +40 -0
- data/lib/cdss/models/structure.rb +101 -0
- data/lib/cdss/models/water_right.rb +47 -0
- data/lib/cdss/models/well.rb +43 -0
- data/lib/cdss/parser.rb +172 -0
- data/lib/cdss/parsers/admin_calls_parser.rb +47 -0
- data/lib/cdss/parsers/analysis_parser.rb +124 -0
- data/lib/cdss/parsers/base_parser.rb +18 -0
- data/lib/cdss/parsers/climate_parser.rb +86 -0
- data/lib/cdss/parsers/reading_parser.rb +90 -0
- data/lib/cdss/parsers/reference_tables_parser.rb +55 -0
- data/lib/cdss/parsers/station_parser.rb +42 -0
- data/lib/cdss/parsers/structures_parser.rb +96 -0
- data/lib/cdss/parsers/water_rights_parser.rb +77 -0
- data/lib/cdss/parsers/well_parser.rb +107 -0
- data/lib/cdss/reference_tables.rb +147 -0
- data/lib/cdss/structures.rb +235 -0
- data/lib/cdss/surface_water.rb +186 -0
- data/lib/cdss/telemetry.rb +98 -0
- data/lib/cdss/utils.rb +152 -0
- data/lib/cdss/version.rb +5 -0
- data/lib/cdss/water_rights.rb +95 -0
- data/lib/cdss.rb +27 -0
- data/sig/cdss/ruby.rbs +6 -0
- metadata +272 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Concerns
|
5
|
+
# A concern module that adds well reading-related attributes to classes.
|
6
|
+
#
|
7
|
+
# This module provides a comprehensive set of standardized attributes for well reading data,
|
8
|
+
# including identification, location, measurement, and publication information.
|
9
|
+
# When included in a class, it dynamically adds accessor methods for these attributes.
|
10
|
+
#
|
11
|
+
# @example Adding well reading attributes to a class
|
12
|
+
# class WellReading
|
13
|
+
# include Cdss::Concerns::WellReadingAttributes
|
14
|
+
# end
|
15
|
+
module WellReadingAttributes
|
16
|
+
# Predefined list of well reading attributes
|
17
|
+
#
|
18
|
+
# @return [Array<Symbol>] List of attributes related to well readings
|
19
|
+
WELL_ATTRIBUTES = %i[
|
20
|
+
well_id
|
21
|
+
well_name
|
22
|
+
division
|
23
|
+
water_district
|
24
|
+
county
|
25
|
+
management_district
|
26
|
+
designated_basin
|
27
|
+
publication
|
28
|
+
depth_to_water
|
29
|
+
measuring_point_above_land_surface
|
30
|
+
measurement_date
|
31
|
+
depth_water_below_land_surface
|
32
|
+
elevation_of_water
|
33
|
+
delta
|
34
|
+
published
|
35
|
+
].freeze
|
36
|
+
|
37
|
+
# Dynamically adds accessor methods when the module is included in a class
|
38
|
+
#
|
39
|
+
# @param [Class] base The class including this module
|
40
|
+
def self.included(base)
|
41
|
+
base.class_eval do
|
42
|
+
attr_accessor(*WELL_ATTRIBUTES)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Checks if the instance has a valid well reading
|
47
|
+
#
|
48
|
+
# @return [Boolean] true if a well ID is present, false otherwise
|
49
|
+
# @example Check if a well reading is valid
|
50
|
+
# well_reading.well_reading? # => true or false
|
51
|
+
def well_reading?
|
52
|
+
!well_id.nil?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module GroundWater
|
5
|
+
include Utils
|
6
|
+
|
7
|
+
# Fetches groundwater water level wells based on filters.
|
8
|
+
#
|
9
|
+
# @param [String, nil] county County to filter wells
|
10
|
+
# @param [String, nil] designated_basin Designated basin to filter wells
|
11
|
+
# @param [Integer, nil] division Division to filter wells
|
12
|
+
# @param [String, nil] management_district Management district to filter wells
|
13
|
+
# @param [Integer, nil] water_district Water district number to filter wells
|
14
|
+
# @param [String, nil] wellid Well ID to filter specific well
|
15
|
+
# @return [Array<Well>] An array of groundwater well objects
|
16
|
+
# @example Fetch wells in Denver county
|
17
|
+
# client.get_water_level_wells(county: 'Denver')
|
18
|
+
def get_water_level_wells(county: nil, designated_basin: nil, division: nil, management_district: nil,
|
19
|
+
water_district: nil, wellid: nil)
|
20
|
+
query = {
|
21
|
+
format: "json",
|
22
|
+
dateFormat: "spaceSepToSeconds",
|
23
|
+
county: county&.upcase&.gsub(" ", "+"),
|
24
|
+
designatedBasin: designated_basin&.upcase&.gsub(" ", "+"),
|
25
|
+
division: division,
|
26
|
+
managementDistrict: management_district&.upcase&.gsub(" ", "+"),
|
27
|
+
waterDistrict: water_district,
|
28
|
+
wellId: wellid
|
29
|
+
}
|
30
|
+
|
31
|
+
fetch_paginated_data(
|
32
|
+
endpoint: "/groundwater/waterlevels/wells/",
|
33
|
+
query: query
|
34
|
+
) { |data| Parser.parse_wells(data) }
|
35
|
+
end
|
36
|
+
|
37
|
+
# Fetches water level measurements for a specific well
|
38
|
+
#
|
39
|
+
# @param [String] wellid Well ID to fetch measurements for
|
40
|
+
# @param [Date, nil] start_date Start date for the data range
|
41
|
+
# @param [Date, nil] end_date End date for the data range
|
42
|
+
# @return [Array<Reading>] An array of water level measurements
|
43
|
+
# @example Fetch measurements for a specific well
|
44
|
+
# client.get_well_measurements(wellid: '1234', start_date: Date.parse('2021-01-01'))
|
45
|
+
def get_well_measurements(wellid:, start_date: nil, end_date: nil)
|
46
|
+
query = {
|
47
|
+
format: "json",
|
48
|
+
dateFormat: "spaceSepToSeconds",
|
49
|
+
wellId: wellid,
|
50
|
+
"min-measurementDate": start_date&.strftime("%m-%d-%Y"),
|
51
|
+
"max-measurementDate": end_date&.strftime("%m-%d-%Y")
|
52
|
+
}
|
53
|
+
|
54
|
+
fetch_paginated_data(
|
55
|
+
endpoint: "/groundwater/waterlevels/wellmeasurements/",
|
56
|
+
query: query
|
57
|
+
) { |data| Parser.parse_well_measurements(data) }
|
58
|
+
end
|
59
|
+
|
60
|
+
# Fetches groundwater geophysical log wells based on filters
|
61
|
+
#
|
62
|
+
# @param [String, nil] county County to filter wells
|
63
|
+
# @param [String, nil] designated_basin Designated basin to filter wells
|
64
|
+
# @param [Integer, nil] division Division to filter wells
|
65
|
+
# @param [String, nil] management_district Management district to filter wells
|
66
|
+
# @param [Integer, nil] water_district Water district number to filter wells
|
67
|
+
# @param [String, nil] wellid Well ID to filter specific well
|
68
|
+
# @return [Array<Well>] An array of geophysical log well objects
|
69
|
+
# @example Fetch geophysical log wells in Denver county
|
70
|
+
# client.get_geophysical_log_wells(county: 'Denver')
|
71
|
+
def get_geophysical_log_wells(county: nil, designated_basin: nil, division: nil, management_district: nil,
|
72
|
+
water_district: nil, wellid: nil)
|
73
|
+
query = {
|
74
|
+
format: "json",
|
75
|
+
dateFormat: "spaceSepToSeconds",
|
76
|
+
county: county&.upcase&.gsub(" ", "+"),
|
77
|
+
designatedBasin: designated_basin&.upcase&.gsub(" ", "+"),
|
78
|
+
division: division,
|
79
|
+
managementDistrict: management_district&.upcase&.gsub(" ", "+"),
|
80
|
+
waterDistrict: water_district,
|
81
|
+
wellId: wellid
|
82
|
+
}
|
83
|
+
|
84
|
+
fetch_paginated_data(
|
85
|
+
endpoint: "/groundwater/geophysicallogs/wells/",
|
86
|
+
query: query
|
87
|
+
) { |data| Parser.parse_geophysical_wells(data) }
|
88
|
+
end
|
89
|
+
|
90
|
+
# Fetches geophysical log picks for a specific well
|
91
|
+
#
|
92
|
+
# @param [String] wellid Well ID to fetch log picks for
|
93
|
+
# @return [Array<LogPick>] An array of geophysical log pick objects
|
94
|
+
# @raise [ArgumentError] if wellid is nil
|
95
|
+
# @example Fetch log picks for a specific well
|
96
|
+
# client.get_geophysical_log_picks(wellid: '1234')
|
97
|
+
def get_geophysical_log_picks(wellid:)
|
98
|
+
raise ArgumentError, "wellid is required" if wellid.nil?
|
99
|
+
|
100
|
+
query = {
|
101
|
+
format: "json",
|
102
|
+
dateFormat: "spaceSepToSeconds",
|
103
|
+
wellId: wellid
|
104
|
+
}
|
105
|
+
|
106
|
+
fetch_paginated_data(
|
107
|
+
endpoint: "/groundwater/geophysicallogs/geoplogpicks/",
|
108
|
+
query: query
|
109
|
+
) { |data| Parser.parse_log_picks(data) }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class AdminCall
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
call_number
|
8
|
+
call_type
|
9
|
+
date_time_set
|
10
|
+
date_time_released
|
11
|
+
water_source_name
|
12
|
+
location_wdid
|
13
|
+
location_wdid_streammile
|
14
|
+
location_structure_name
|
15
|
+
priority_wdid
|
16
|
+
priority_structure_name
|
17
|
+
priority_admin_number
|
18
|
+
priority_order_number
|
19
|
+
priority_date
|
20
|
+
priority_number
|
21
|
+
bounding_wdid
|
22
|
+
bounding_structure_name
|
23
|
+
set_comments
|
24
|
+
release_comment
|
25
|
+
division
|
26
|
+
location_structure_latitude
|
27
|
+
location_structure_longitude
|
28
|
+
bounding_structure_latitude
|
29
|
+
bounding_structure_longitude
|
30
|
+
modified
|
31
|
+
more_information
|
32
|
+
metadata
|
33
|
+
].freeze
|
34
|
+
|
35
|
+
attr_accessor(*ATTRIBUTES)
|
36
|
+
|
37
|
+
def initialize(**attrs)
|
38
|
+
attrs[:metadata] ||= {}
|
39
|
+
ATTRIBUTES.each do |attr|
|
40
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
# Base class for analysis-related models with shared functionality.
|
6
|
+
# Provides dynamic attribute handling for call analysis, source routes,
|
7
|
+
# and route analysis data.
|
8
|
+
class Analysis
|
9
|
+
class << self
|
10
|
+
def attributes(*attrs)
|
11
|
+
@attributes = attrs
|
12
|
+
attr_accessor(*attrs)
|
13
|
+
end
|
14
|
+
|
15
|
+
def inherited(subclass)
|
16
|
+
subclass.attributes(*@attributes) if @attributes
|
17
|
+
end
|
18
|
+
|
19
|
+
def attribute_list
|
20
|
+
@attributes || []
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(**kwargs)
|
25
|
+
kwargs[:metadata] ||= {}
|
26
|
+
self.class.attribute_list.each do |attr|
|
27
|
+
instance_variable_set(:"@#{attr}", kwargs[attr]) if kwargs.key?(attr)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class CallAnalysis < Analysis
|
33
|
+
attributes :analysis_date,
|
34
|
+
:wdid,
|
35
|
+
:gnis_id,
|
36
|
+
:stream_mile,
|
37
|
+
:admin_number,
|
38
|
+
:percent_time_out_of_priority,
|
39
|
+
:downstream_call_wdid,
|
40
|
+
:downstream_call_right,
|
41
|
+
:downstream_call_stream_mile,
|
42
|
+
:downstream_call_admin_number,
|
43
|
+
:downstream_call_decreed_amount,
|
44
|
+
:downstream_call_decreed_unit,
|
45
|
+
:downstream_call_appropriation_date,
|
46
|
+
:downstream_call_status,
|
47
|
+
:modified,
|
48
|
+
:metadata
|
49
|
+
end
|
50
|
+
|
51
|
+
class SourceRoute < Analysis
|
52
|
+
attributes :gnis_id,
|
53
|
+
:gnis_name,
|
54
|
+
:division,
|
55
|
+
:water_district,
|
56
|
+
:stream_length,
|
57
|
+
:tributary_to_level,
|
58
|
+
:tributary_to_gnis_id,
|
59
|
+
:tributary_gnis_name,
|
60
|
+
:tributary_to_stream_mile,
|
61
|
+
:metadata
|
62
|
+
end
|
63
|
+
|
64
|
+
class RouteAnalysis < Analysis
|
65
|
+
attributes :wdid,
|
66
|
+
:structure_name,
|
67
|
+
:stream_mile,
|
68
|
+
:structure_type,
|
69
|
+
:decreed_amount,
|
70
|
+
:decreed_unit,
|
71
|
+
:appropriation_date,
|
72
|
+
:admin_number,
|
73
|
+
:modified,
|
74
|
+
:metadata
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class ClimateStation
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
station_number
|
8
|
+
station_name
|
9
|
+
site_id
|
10
|
+
division
|
11
|
+
water_district
|
12
|
+
county
|
13
|
+
state
|
14
|
+
latitude
|
15
|
+
longitude
|
16
|
+
utm_x
|
17
|
+
utm_y
|
18
|
+
elevation
|
19
|
+
data_source
|
20
|
+
start_date
|
21
|
+
end_date
|
22
|
+
modified
|
23
|
+
more_information
|
24
|
+
parameter_types
|
25
|
+
metadata
|
26
|
+
].freeze
|
27
|
+
|
28
|
+
attr_accessor(*ATTRIBUTES)
|
29
|
+
|
30
|
+
def initialize(**attrs)
|
31
|
+
attrs[:metadata] ||= {}
|
32
|
+
attrs[:parameter_types] ||= []
|
33
|
+
|
34
|
+
ATTRIBUTES.each do |attr|
|
35
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class Reading
|
6
|
+
include Cdss::Concerns::WellReadingAttributes
|
7
|
+
include Cdss::Concerns::LogReadingAttributes
|
8
|
+
|
9
|
+
BASE_ATTRIBUTES = %i[
|
10
|
+
station_num
|
11
|
+
station_number
|
12
|
+
station_name
|
13
|
+
site_id
|
14
|
+
abbrev
|
15
|
+
parameter
|
16
|
+
usgs_site_id
|
17
|
+
meas_type
|
18
|
+
data_source
|
19
|
+
modified
|
20
|
+
metadata
|
21
|
+
flags
|
22
|
+
meas_date
|
23
|
+
value
|
24
|
+
meas_unit
|
25
|
+
meas_value
|
26
|
+
meas_date_time
|
27
|
+
cal_year
|
28
|
+
cal_month_num
|
29
|
+
water_year
|
30
|
+
min_q_cfs
|
31
|
+
max_q_cfs
|
32
|
+
avg_q_cfs
|
33
|
+
total_q_af
|
34
|
+
meas_count
|
35
|
+
frost_date_32f_fall
|
36
|
+
frost_date_32f_spring
|
37
|
+
frost_date_28f_fall
|
38
|
+
frost_date_28f_spring
|
39
|
+
].freeze
|
40
|
+
|
41
|
+
ATTRIBUTES = (BASE_ATTRIBUTES + WELL_ATTRIBUTES + LOG_ATTRIBUTES).freeze
|
42
|
+
|
43
|
+
attr_accessor(*ATTRIBUTES)
|
44
|
+
|
45
|
+
def initialize(**attrs)
|
46
|
+
attrs[:metadata] ||= {}
|
47
|
+
attrs[:flags] ||= {}
|
48
|
+
ATTRIBUTES.each do |attr|
|
49
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr) && attrs[attr]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class ReferenceTable
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
name
|
8
|
+
code
|
9
|
+
description
|
10
|
+
division
|
11
|
+
water_district
|
12
|
+
water_district_name
|
13
|
+
division_name
|
14
|
+
county
|
15
|
+
management_district
|
16
|
+
management_district_name
|
17
|
+
designated_basin
|
18
|
+
designated_basin_name
|
19
|
+
parameter
|
20
|
+
flag
|
21
|
+
flag_column
|
22
|
+
divrectype
|
23
|
+
div_rec_type_long
|
24
|
+
additional_info
|
25
|
+
data_source
|
26
|
+
publication_name
|
27
|
+
action_name
|
28
|
+
action_descr
|
29
|
+
ciu_code
|
30
|
+
ciu_code_long
|
31
|
+
obs_code
|
32
|
+
obs_code_long
|
33
|
+
obs_descr
|
34
|
+
start_iyr
|
35
|
+
end_iyr
|
36
|
+
not_used_code
|
37
|
+
not_used_code_descr
|
38
|
+
submission_type
|
39
|
+
metadata
|
40
|
+
].freeze
|
41
|
+
|
42
|
+
attr_accessor(*ATTRIBUTES)
|
43
|
+
|
44
|
+
def initialize(**attrs)
|
45
|
+
attrs[:metadata] ||= {}
|
46
|
+
ATTRIBUTES.each do |attr|
|
47
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr) && !blank_or_nil?(attrs[attr])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def blank_or_nil?(value)
|
52
|
+
value.nil? || value.to_s.strip.empty?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class Station
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
station_num
|
8
|
+
abbrev
|
9
|
+
usgs_site_id
|
10
|
+
name
|
11
|
+
agency
|
12
|
+
latitude
|
13
|
+
longitude
|
14
|
+
division
|
15
|
+
water_district
|
16
|
+
county
|
17
|
+
state
|
18
|
+
utm_x
|
19
|
+
utm_y
|
20
|
+
location_accuracy
|
21
|
+
start_date
|
22
|
+
end_date
|
23
|
+
modified
|
24
|
+
more_information
|
25
|
+
meas_unit
|
26
|
+
metadata
|
27
|
+
].freeze
|
28
|
+
|
29
|
+
attr_accessor(*ATTRIBUTES)
|
30
|
+
|
31
|
+
def initialize(**attrs)
|
32
|
+
attrs[:metadata] ||= {}
|
33
|
+
|
34
|
+
ATTRIBUTES.each do |attr|
|
35
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr) && attrs[attr]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class Structure
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
wdid
|
8
|
+
structure_name
|
9
|
+
structure_type
|
10
|
+
water_source
|
11
|
+
location_wdid
|
12
|
+
location_name
|
13
|
+
location_stream_mile
|
14
|
+
gnis_id
|
15
|
+
division
|
16
|
+
water_district
|
17
|
+
county
|
18
|
+
designated_basin
|
19
|
+
management_district
|
20
|
+
latitude
|
21
|
+
longitude
|
22
|
+
utm_x
|
23
|
+
utm_y
|
24
|
+
stream_num
|
25
|
+
structure_num
|
26
|
+
ciu_code
|
27
|
+
ciucode_desc
|
28
|
+
modified
|
29
|
+
stage_volume
|
30
|
+
usgs_id
|
31
|
+
data_source
|
32
|
+
more_information
|
33
|
+
metadata
|
34
|
+
].freeze
|
35
|
+
|
36
|
+
attr_accessor(*ATTRIBUTES)
|
37
|
+
|
38
|
+
def initialize(**attrs)
|
39
|
+
attrs[:metadata] ||= {}
|
40
|
+
|
41
|
+
ATTRIBUTES.each do |attr|
|
42
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class DiversionRecord < Structure
|
48
|
+
ATTRIBUTES = %i[
|
49
|
+
wdid
|
50
|
+
water_class_num
|
51
|
+
wc_identifier
|
52
|
+
meas_interval
|
53
|
+
meas_count
|
54
|
+
data_meas_date
|
55
|
+
data_value
|
56
|
+
meas_units
|
57
|
+
obs_code
|
58
|
+
approval_status
|
59
|
+
modified
|
60
|
+
metadata
|
61
|
+
].freeze
|
62
|
+
|
63
|
+
attr_accessor(*ATTRIBUTES)
|
64
|
+
|
65
|
+
def initialize(**attrs)
|
66
|
+
super
|
67
|
+
attrs[:metadata] ||= {}
|
68
|
+
ATTRIBUTES.each do |attr|
|
69
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class WaterClass < Structure
|
75
|
+
ATTRIBUTES = %i[
|
76
|
+
wc_identifier
|
77
|
+
por_start
|
78
|
+
por_end
|
79
|
+
div_type
|
80
|
+
timestep
|
81
|
+
units
|
82
|
+
source_code
|
83
|
+
use_code
|
84
|
+
op_code
|
85
|
+
modified
|
86
|
+
metadata
|
87
|
+
].freeze
|
88
|
+
|
89
|
+
attr_accessor(*ATTRIBUTES)
|
90
|
+
|
91
|
+
def initialize(**attrs)
|
92
|
+
super
|
93
|
+
attrs[:metadata] ||= {}
|
94
|
+
|
95
|
+
ATTRIBUTES.each do |attr|
|
96
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class WaterRight
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
wdid
|
8
|
+
water_right_name
|
9
|
+
admin_number
|
10
|
+
appropriation_date
|
11
|
+
padj_date
|
12
|
+
adj_type
|
13
|
+
adj_date
|
14
|
+
order_number
|
15
|
+
prior_cases
|
16
|
+
status
|
17
|
+
trans_id
|
18
|
+
trans_type
|
19
|
+
case_number
|
20
|
+
decreed_uses
|
21
|
+
decreed_amount
|
22
|
+
decreed_units
|
23
|
+
action_comment
|
24
|
+
action_update
|
25
|
+
county
|
26
|
+
water_district
|
27
|
+
division
|
28
|
+
stream_mile
|
29
|
+
structure_type
|
30
|
+
latitude
|
31
|
+
longitude
|
32
|
+
modified
|
33
|
+
metadata
|
34
|
+
].freeze
|
35
|
+
|
36
|
+
attr_accessor(*ATTRIBUTES)
|
37
|
+
|
38
|
+
def initialize(**attrs)
|
39
|
+
attrs[:metadata] ||= {}
|
40
|
+
|
41
|
+
ATTRIBUTES.each do |attr|
|
42
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cdss
|
4
|
+
module Models
|
5
|
+
class Well
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
well_id
|
8
|
+
well_name
|
9
|
+
latitude
|
10
|
+
longitude
|
11
|
+
location_accuracy
|
12
|
+
county
|
13
|
+
designated_basin
|
14
|
+
management_district
|
15
|
+
division
|
16
|
+
water_district
|
17
|
+
depth
|
18
|
+
elevation
|
19
|
+
start_date
|
20
|
+
end_date
|
21
|
+
modified
|
22
|
+
data_source
|
23
|
+
more_information
|
24
|
+
total_depth
|
25
|
+
ground_elevation
|
26
|
+
utm_x
|
27
|
+
utm_y
|
28
|
+
state
|
29
|
+
metadata
|
30
|
+
].freeze
|
31
|
+
|
32
|
+
attr_accessor(*ATTRIBUTES)
|
33
|
+
|
34
|
+
def initialize(**attrs)
|
35
|
+
attrs[:metadata] ||= {}
|
36
|
+
|
37
|
+
ATTRIBUTES.each do |attr|
|
38
|
+
instance_variable_set(:"@#{attr}", attrs[attr]) if attrs.key?(attr) && attrs[attr]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|