Base variable
Base variable
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 |
pandas.DataFrame
|
Dataframe with the observations |
pcobservations |
pandas.DataFrame
|
Dataframe with the pixel count |
catchment_names |
list
|
List of catchment names |
Source code in hidrocl/variables/__init__.py
8 9 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 |
|
__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 hidrocl/variables/__init__.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
__repr__()
Representation of the object
Returns:
Name | Type | Description |
---|---|---|
str | Representation of the object |
Source code in hidrocl/variables/__init__.py
44 45 46 47 48 49 50 51 |
|
__str__()
String representation of the object
Returns:
Name | Type | Description |
---|---|---|
str | String representation of the object |
Source code in hidrocl/variables/__init__.py
53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
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 hidrocl/variables/__init__.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
checkdatabase()
Check database
Returns:
Type | Description |
---|---|
pandas.DataFrame: Dataframe with the observations |
Source code in hidrocl/variables/__init__.py
80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
checkindatabase()
Check IDs in database
Returns:
Name | Type | Description |
---|---|---|
list | List of IDs in the database |
Source code in hidrocl/variables/__init__.py
67 68 69 70 71 72 73 74 75 76 77 78 |
|
checkpcdatabase()
Check database with pixel count
Returns:
Type | Description |
---|---|
pandas.DataFrame: Dataframe with the pixel count |
Source code in hidrocl/variables/__init__.py
94 95 96 97 98 99 100 101 |
|
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 hidrocl/variables/__init__.py
144 145 146 147 148 149 150 151 |
|
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 hidrocl/variables/__init__.py
153 154 155 156 157 158 159 160 |
|
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 hidrocl/variables/__init__.py
176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
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 hidrocl/variables/__init__.py
131 132 133 134 135 136 137 138 139 140 141 142 |
|
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 hidrocl/variables/__init__.py
162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
valid_data()
Return valid data for all catchments
Returns:
Name | Type | Description |
---|---|---|
list | list with valid data with date index |
Source code in hidrocl/variables/__init__.py
122 123 124 125 126 127 128 129 |
|