scdata 1.0.1__tar.gz → 1.0.2__tar.gz
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.
- {scdata-1.0.1/scdata.egg-info → scdata-1.0.2}/PKG-INFO +2 -2
- {scdata-1.0.1 → scdata-1.0.2}/requirements.txt +1 -1
- {scdata-1.0.1 → scdata-1.0.2}/scdata/__init__.py +1 -1
- {scdata-1.0.1 → scdata-1.0.2}/scdata/_config/config.py +2 -16
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/device.py +2 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/models/models.py +1 -1
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/test.py +27 -16
- {scdata-1.0.1 → scdata-1.0.2/scdata.egg-info}/PKG-INFO +2 -2
- {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/requires.txt +1 -1
- {scdata-1.0.1 → scdata-1.0.2}/setup.py +1 -1
- {scdata-1.0.1 → scdata-1.0.2}/LICENSE +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/MANIFEST.in +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/README.md +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/_config/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/_config/custom_logger.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/alphasense.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/baseline.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/formulae.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/geoseries.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/params.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/regression.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/device/process/timeseries.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/io/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/io/device_api.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/io/device_file.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/io/model.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/models/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/checks/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/checks/checks.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/dispersion/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/dispersion/dispersion.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/export/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/export/templates/sc_template.html +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/export/to_file.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/box_plot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/heatmap_iplot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/heatmap_plot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/maps.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/plot_tools.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/scatter_dispersion_grid.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/scatter_iplot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/scatter_plot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/target_diagram.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dendrogram.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dispersion_grid.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dispersion_plot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_dispersion_uplot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_iplot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_plot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_scatter.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/plot/ts_uplot.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/combine.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/history.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/test/tools/prepare.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/__init__.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/cleaning.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/custom_logger.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/date.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/dictmerge.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/find.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/gets.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/interim/example.csv +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/interim/geodata.csv +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/lazy.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/location.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/report.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/stats.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/units.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/uploads/example_upload_1.json +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/uploads/example_zenodo_upload.yaml +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/uploads/report.pdf +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/url_check.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo.py +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo_templates/README.md +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo_templates/template_zenodo_dataset.json +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo_templates/template_zenodo_publication.json +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/SOURCES.txt +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/dependency_links.txt +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/not-zip-safe +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/scdata.egg-info/top_level.txt +0 -0
- {scdata-1.0.1 → scdata-1.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: scdata
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Analysis of sensors and time series data
|
|
5
5
|
Home-page: https://github.com/fablabbcn/smartcitizen-data
|
|
6
6
|
Author: oscgonfer
|
|
@@ -29,7 +29,7 @@ Requires-Dist: numpy~=1.25.2
|
|
|
29
29
|
Requires-Dist: pandas~=2.2.2
|
|
30
30
|
Requires-Dist: pydantic
|
|
31
31
|
Requires-Dist: pytest
|
|
32
|
-
Requires-Dist: PyYAML
|
|
32
|
+
Requires-Dist: PyYAML~=6.0.1
|
|
33
33
|
Requires-Dist: requests
|
|
34
34
|
Requires-Dist: scipy
|
|
35
35
|
Requires-Dist: scikit-learn
|
|
@@ -38,9 +38,6 @@ class Config(object):
|
|
|
38
38
|
if 'IPython' in sys.modules: _ipython_avail = True
|
|
39
39
|
else: _ipython_avail = False
|
|
40
40
|
|
|
41
|
-
# Returns when iterables cannot be fully processed
|
|
42
|
-
_strict = False
|
|
43
|
-
|
|
44
41
|
# Timeout for http requests
|
|
45
42
|
_timeout = 3
|
|
46
43
|
_max_http_retries = 2
|
|
@@ -51,20 +48,9 @@ class Config(object):
|
|
|
51
48
|
### ---------------------------------------
|
|
52
49
|
### -----------------DATA------------------
|
|
53
50
|
### ---------------------------------------
|
|
54
|
-
|
|
55
51
|
data = {
|
|
56
|
-
|
|
57
|
-
'reload_metadata': True
|
|
58
|
-
# Whether or not to load or store cached data (saves time when requesting a lot of data)
|
|
59
|
-
'load_cached_api': True,
|
|
60
|
-
'store_cached_api': True,
|
|
61
|
-
# If reloading data from the API, how much gap between the saved data and the
|
|
62
|
-
# latest reading in the API should be ignore
|
|
63
|
-
'cached_data_margin': 1,
|
|
64
|
-
# clean_na
|
|
65
|
-
'clean_na': None,
|
|
66
|
-
# Ignore additional channels from API or CSV that are not in the blueprint.json
|
|
67
|
-
'strict_load': False
|
|
52
|
+
'cached_data_margin': '10Min', # Data Margin in minutes for consecutive requests
|
|
53
|
+
'reload_metadata': True # Reload metadata
|
|
68
54
|
}
|
|
69
55
|
|
|
70
56
|
# Maximum amount of points to load when postprocessing data
|
|
@@ -300,6 +300,7 @@ class Device(BaseModel):
|
|
|
300
300
|
else:
|
|
301
301
|
raise NotImplementedError(f'Cache needs to be a .csv file. Got {cache}.')
|
|
302
302
|
|
|
303
|
+
# Make request with a logical min_date
|
|
303
304
|
if not cached_data.empty:
|
|
304
305
|
# Update min_date
|
|
305
306
|
min_date=cached_data.index[-1].tz_convert('UTC')+Timedelta(frequency)
|
|
@@ -327,6 +328,7 @@ class Device(BaseModel):
|
|
|
327
328
|
# In principle this links both dataframes as they are unmutable
|
|
328
329
|
self.data = self.handler.data
|
|
329
330
|
# Wrap it all up
|
|
331
|
+
# TODO Avoid doing this if not needed?
|
|
330
332
|
self.loaded = self.__load_wrapup__(max_amount, convert_units=convert_units, convert_names=convert_names, cached_data=cached_data)
|
|
331
333
|
|
|
332
334
|
self.processed = False
|
|
@@ -67,7 +67,6 @@ class Test(BaseModel):
|
|
|
67
67
|
|
|
68
68
|
self.devices = TypeAdapter(List[Device]).validate_python(tj['devices'])
|
|
69
69
|
self.options = TypeAdapter(TestOptions).validate_python(tj['options'])
|
|
70
|
-
print (tj['meta'])
|
|
71
70
|
self.type = tj['meta']['type']
|
|
72
71
|
if self.name != tj['meta']['name']:
|
|
73
72
|
raise ValueError('Name not matching')
|
|
@@ -334,20 +333,20 @@ class Test(BaseModel):
|
|
|
334
333
|
|
|
335
334
|
return fname
|
|
336
335
|
|
|
337
|
-
def cache(self):
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
# def cache(self):
|
|
337
|
+
# logger.info(f'Caching files...')
|
|
338
|
+
# for device in self.devices:
|
|
339
|
+
# logger.info(f'Caching files for {device.id}...')
|
|
341
340
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
341
|
+
# cached_file_path = join(self.path, 'cached')
|
|
342
|
+
# if not exists(cached_file_path):
|
|
343
|
+
# logger.info('Creating path for exporting cached data')
|
|
344
|
+
# makedirs(cached_file_path)
|
|
346
345
|
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
# if device.export(cached_file_path, forced_overwrite = True, file_format = 'csv'):
|
|
347
|
+
# logger.info(f'Device {device.id} cached')
|
|
349
348
|
|
|
350
|
-
|
|
349
|
+
# return all([exists(join(self.path, 'cached', f'{d.id}.csv')) for d in self.devices])
|
|
351
350
|
|
|
352
351
|
async def load(self):
|
|
353
352
|
'''
|
|
@@ -359,17 +358,29 @@ class Test(BaseModel):
|
|
|
359
358
|
'''
|
|
360
359
|
logger.info('Loading test...')
|
|
361
360
|
|
|
361
|
+
if self.options.cache:
|
|
362
|
+
cache_dir = join(self.path, 'cached')
|
|
363
|
+
if not exists(cache_dir):
|
|
364
|
+
logger.info('Creating path for exporting cached data...')
|
|
365
|
+
makedirs(cache_dir)
|
|
366
|
+
logger.info(f'Cache will be available in: {cache_dir}')
|
|
367
|
+
|
|
362
368
|
for device in self.devices:
|
|
363
369
|
# Check for cached data
|
|
364
|
-
|
|
370
|
+
device_cache_path = ''
|
|
365
371
|
if self.options.cache:
|
|
366
372
|
tentative_path = join(self.path, 'cached', f'{device.id}.csv')
|
|
367
|
-
if exists(tentative_path):
|
|
373
|
+
if exists(tentative_path):
|
|
374
|
+
device_cache_path = tentative_path
|
|
375
|
+
|
|
368
376
|
# Load device (no need to go async, it's fast enough)
|
|
369
|
-
await device.load(cache=
|
|
377
|
+
await device.load(cache=device_cache_path)
|
|
378
|
+
|
|
379
|
+
if self.options.cache:
|
|
380
|
+
if device.export(cache_dir, forced_overwrite = True, file_format = 'csv'):
|
|
381
|
+
logger.info(f'Device {device.id} cached')
|
|
370
382
|
|
|
371
383
|
logger.info('Test load done')
|
|
372
|
-
if self.options.cache: self.cache()
|
|
373
384
|
|
|
374
385
|
self.loaded = all([d.loaded for d in self.devices])
|
|
375
386
|
return self.loaded
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: scdata
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Analysis of sensors and time series data
|
|
5
5
|
Home-page: https://github.com/fablabbcn/smartcitizen-data
|
|
6
6
|
Author: oscgonfer
|
|
@@ -29,7 +29,7 @@ Requires-Dist: numpy~=1.25.2
|
|
|
29
29
|
Requires-Dist: pandas~=2.2.2
|
|
30
30
|
Requires-Dist: pydantic
|
|
31
31
|
Requires-Dist: pytest
|
|
32
|
-
Requires-Dist: PyYAML
|
|
32
|
+
Requires-Dist: PyYAML~=6.0.1
|
|
33
33
|
Requires-Dist: requests
|
|
34
34
|
Requires-Dist: scipy
|
|
35
35
|
Requires-Dist: scikit-learn
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scdata-1.0.1 → scdata-1.0.2}/scdata/tools/zenodo_templates/template_zenodo_publication.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|