You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Data is stored in 2 sources : one. Redis cache and second : csv files.
250
-
Redis cache contains data only for the last 72 hours from when it was last synced
251
-
Offline data files can contain data for longer durations.
252
-
Both these options can be configured in the config file
253
-
returns {available:True/False, data:dataframe}
254
-
Note that this method assumes that syncing of the sources is being handled separately
248
+
This method returns locally stored energy data.
249
+
250
+
Data is stored in two sources:
251
+
252
+
1. **Redis cache**: Contains data for a limited number of hours from the last sync.
253
+
2. **CSV files**: Contain data for longer durations.
254
+
255
+
Both storage options can be configured in the configuration file.
256
+
257
+
**Note**: Unless you specify the ``sync_first`` flag, the method assumes that syncing of the data sources is handled separately. If ``sync_first`` is set to ``True`` and data files are not initialized in advance, the method may take longer to complete
258
+
259
+
:return: A dictionary with the following keys:
260
+
- **available** (*bool*): Indicates if the data is available.
261
+
- **data** (*pandas.DataFrame*): The energy data, if available. Otherwise, an empty DataFrame.
This method syncs offline data for offline sources enabled in the cache.
296
-
Data is synced for all available countries
297
-
You need to run this before getting offline data. you can even setup a CRON job to call this method on regular intervals
306
+
This method syncs offline data for offline sources enabled in the configuration file. The data is synced for all available countries.
307
+
308
+
You need to run this method before retrieving offline data. It is also possible to set up a CRON job to call this method at regular intervals to keep data synchronized.
309
+
310
+
The sync operation can take some time, depending on the data size and the selected sync options (file, cache, or both).
311
+
312
+
:param bool file: If ``True``, sync data in offline files. Defaults to ``False``.
313
+
:param bool cache: If ``True``, sync data in the cache. Defaults to ``False``.
Copy file name to clipboardExpand all lines: docs/api.rst
+2-50Lines changed: 2 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -1,57 +1,9 @@
1
1
codegreen_core API
2
2
===================
3
3
4
-
5
-
Package Organization
6
-
---------------------
7
-
8
-
.. image:: _static/modules.png
9
-
:alt:modules
10
-
:width:400px
11
-
:align:center
12
-
13
-
14
-
The package is divided into two main sub packages: `data`` and `tools`. (There is also an additional module, `utilities`, which provides helper methods that support other modules.)
15
-
16
-
The `data` sub package contains methods for fetching energy production data. This package relies on external data sources to retrieve this information, which is then processed to make it usable by other components of the package. For more details and a complete API , see the data module documentation.
17
-
18
-
The `tools` sub package provides a variety of tools, including:
19
-
20
-
- Carbon intensity calculator
21
-
- Carbon emission calculator
22
-
- Optimal time-shifting predictor
23
-
- Optimal location-shifting predictor
24
-
25
-
26
-
Example : Calculating optimal time for a computational task
Copy file name to clipboardExpand all lines: docs/methodology.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Here we describe how we calcualte stuff
6
6
7
7
8
8
``tools`` Module
9
-
=================
9
+
------------------
10
10
11
11
This subpackage provides tools and methods for tasks like calculating the carbon intensity of energy production and calculating the emissions produced due to a computation.
0 commit comments