Base variable
The HidroCLVariable class is the fundamental building block of the library. It represents a hydrometeorological variable linked to two CSV databases: one with extracted values and one with valid pixel counts per catchment.
All product extractor classes require one or more HidroCLVariable objects as arguments.
HidroCLVariable
A class to hold information about a hidrocl variable
Examples:
>>> from hidrocl import HidroCLVariable
>>> variable = HidroCLVariable('precipitation', 'precipitation.csv', 'precipitation_pc.csv')
>>> variable
Variable: precipitation. Records: 0
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the variable |
database |
str
|
Path to the database |
pcdatabase |
str
|
Path to the database with pixel count |
indatabase |
list
|
List of IDs in the database |
observations |
DataFrame
|
Dataframe with the observations |
pcobservations |
DataFrame
|
Dataframe with the pixel count |
catchment_names |
list
|
List of catchment names |
Source code in variables/__init__.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
__init__(name, database, pcdatabase)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the variable |
required |
database
|
str
|
Path to the database |
required |
pcdatabase
|
str
|
Path to the database with pixel count |
required |
Source code in variables/__init__.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
__repr__()
Representation of the object
Returns:
| Name | Type | Description |
|---|---|---|
str |
Representation of the object |
Source code in variables/__init__.py
46 47 48 49 50 51 52 53 | |
__str__()
String representation of the object
Returns:
| Name | Type | Description |
|---|---|---|
str |
String representation of the object |
Source code in variables/__init__.py
55 56 57 58 59 60 61 62 63 64 65 66 67 | |
add_catchment_names(catchment_names_list)
Add catchment names to the variable using cathment_names from database
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catchment_names_list
|
list
|
list of catchment names |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in variables/__init__.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
checkdatabase()
Check database
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: Dataframe with the observations |
Source code in variables/__init__.py
82 83 84 85 86 87 88 89 90 91 92 93 94 | |
checkindatabase()
Check IDs in database
Returns:
| Name | Type | Description |
|---|---|---|
list |
List of IDs in the database |
Source code in variables/__init__.py
69 70 71 72 73 74 75 76 77 78 79 80 | |
checkpcdatabase()
Check database with pixel count
Returns:
| Type | Description |
|---|---|
|
pandas.DataFrame: Dataframe with the pixel count |
Source code in variables/__init__.py
96 97 98 99 100 101 102 103 | |
plot_grid_data_all()
Plot valid data for all catchments in grid format
Returns:
| Name | Type | Description |
|---|---|---|
plot |
plot with valid data for all catchments with date index |
Source code in variables/__init__.py
146 147 148 149 150 151 152 153 | |
plot_grid_pcdata_all()
Plot valid data for all catchments in grid format
Returns:
| Name | Type | Description |
|---|---|---|
plot |
plot with valid data for all catchments with date index |
Source code in variables/__init__.py
155 156 157 158 159 160 161 162 | |
plot_pixel_count(catchment)
Plot pixel count for individual catchments
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catchment
|
str
|
catchment (catchment name) or int (catchment index) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
plot |
plot with pixel count for individual catchments with date index |
Source code in variables/__init__.py
178 179 180 181 182 183 184 185 186 187 188 189 190 | |
plot_valid_data_all()
Plot valid data for all catchments
Returns:
| Name | Type | Description |
|---|---|---|
plot |
plot with valid data for all catchments with date index |
Source code in variables/__init__.py
133 134 135 136 137 138 139 140 141 142 143 144 | |
plot_valid_data_individual(catchment)
Plot valid data for individual catchments
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catchment
|
str
|
catchment (catchment name) or int (catchment index) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
plot |
plot with valid data for individual catchments with date index |
Source code in variables/__init__.py
164 165 166 167 168 169 170 171 172 173 174 175 176 | |
valid_data()
Return valid data for all catchments
Returns:
| Name | Type | Description |
|---|---|---|
list |
list with valid data with date index |
Source code in variables/__init__.py
124 125 126 127 128 129 130 131 | |