@@ -922,7 +922,7 @@ def getDataSetsResults(self, ids=None, codes=None, uuids=None, dstype=None):
922
922
print ('Error running Query {}' .format (e ))
923
923
return None
924
924
925
- def getDataSetsValues (self , ids = None , codes = None , uuids = None , dstype = None ):
925
+ def getDataSetsValues (self , ids = None , codes = None , uuids = None , dstype = None , lowercols = True ):
926
926
"""
927
927
Retrieve a list of datavalues associated with the given dataset info
928
928
@@ -933,6 +933,12 @@ def getDataSetsValues(self, ids=None, codes=None, uuids=None, dstype=None):
933
933
uuids (list, optional): List of Dataset UUIDs string.
934
934
dstype (str, optional): Type of Dataset from
935
935
`controlled vocabulary name <http://vocabulary.odm2.org/datasettype/>`_.
936
+ lowercols (bool, optional): Make column names to be lowercase.
937
+ Default to True.
938
+ **Please start upgrading your code to rely on CamelCase column names,
939
+ In a near-future release,
940
+ the default will be changed to False,
941
+ and later the parameter may be removed**.
936
942
937
943
938
944
Returns:
@@ -944,7 +950,7 @@ def getDataSetsValues(self, ids=None, codes=None, uuids=None, dstype=None):
944
950
>>> READ.getDataSetsValues(codes=['HOME', 'FIELD'])
945
951
>>> READ.getDataSetsValues(uuids=['a6f114f1-5416-4606-ae10-23be32dbc202',
946
952
... '5396fdf3-ceb3-46b6-aaf9-454a37278bb4'])
947
- >>> READ.getDataSetsValues(dstype='singleTimeSeries')
953
+ >>> READ.getDataSetsValues(dstype='singleTimeSeries', lowercols=False )
948
954
949
955
"""
950
956
@@ -955,7 +961,7 @@ def getDataSetsValues(self, ids=None, codes=None, uuids=None, dstype=None):
955
961
resids .append (ds .ResultID )
956
962
957
963
try :
958
- return self .getResultValues (resultids = resids )
964
+ return self .getResultValues (resultids = resids , lowercols = lowercols )
959
965
except Exception as e :
960
966
print ('Error running Query {}' .format (e ))
961
967
return None
@@ -1338,7 +1344,7 @@ def getResultDerivationEquations(self):
1338
1344
"""
1339
1345
return self ._session .query (ResultDerivationEquations ).all ()
1340
1346
1341
- def getResultValues (self , resultids , starttime = None , endtime = None ):
1347
+ def getResultValues (self , resultids , starttime = None , endtime = None , lowercols = True ):
1342
1348
"""
1343
1349
Retrieve result values associated with the given result.
1344
1350
@@ -1347,6 +1353,12 @@ def getResultValues(self, resultids, starttime=None, endtime=None):
1347
1353
resultids (list): List of SamplingFeatureIDs.
1348
1354
starttime (object, optional): Start time to filter by as datetime object.
1349
1355
endtime (object, optional): End time to filter by as datetime object.
1356
+ lowercols (bool, optional): Make column names to be lowercase.
1357
+ Default to True.
1358
+ **Please start upgrading your code to rely on CamelCase column names,
1359
+ In a near-future release,
1360
+ the default will be changed to False,
1361
+ and later the parameter may be removed**.
1350
1362
1351
1363
Returns:
1352
1364
DataFrame: Pandas dataframe of result values.
@@ -1357,7 +1369,7 @@ def getResultValues(self, resultids, starttime=None, endtime=None):
1357
1369
>>> READ.getResultValues(resultids=[100, 20, 34], starttime=datetime.today())
1358
1370
>>> READ.getResultValues(resultids=[1, 2, 3, 4],
1359
1371
>>> starttime=datetime(2000, 01, 01),
1360
- >>> endtime=datetime(2003, 02, 01))
1372
+ >>> endtime=datetime(2003, 02, 01), lowercols=False )
1361
1373
1362
1374
"""
1363
1375
restype = self ._session .query (Results ).filter_by (ResultID = resultids [0 ]).first ().ResultTypeCV
@@ -1395,7 +1407,14 @@ def getResultValues(self, resultids, starttime=None, endtime=None):
1395
1407
con = self ._session_factory .engine ,
1396
1408
params = query .params
1397
1409
)
1398
- df .columns = [self ._get_columns (ResultValues )[c ] for c in df .columns ]
1410
+ if not lowercols :
1411
+ df .columns = [self ._get_columns (ResultValues )[c ] for c in df .columns ]
1412
+ else :
1413
+ warnings .warn (
1414
+ 'In a near-future release, '
1415
+ 'the parameter \' lowercols\' default will be changed to False, '
1416
+ 'and later the parameter may be removed.' ,
1417
+ DeprecationWarning , stacklevel = 2 )
1399
1418
return df
1400
1419
except Exception as e :
1401
1420
print ('Error running Query: {}' .format (e ))
0 commit comments