@@ -922,7 +922,7 @@ def getDataSetsResults(self, ids=None, codes=None, uuids=None, dstype=None):
922922 print ('Error running Query {}' .format (e ))
923923 return None
924924
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 ):
926926 """
927927 Retrieve a list of datavalues associated with the given dataset info
928928
@@ -933,6 +933,12 @@ def getDataSetsValues(self, ids=None, codes=None, uuids=None, dstype=None):
933933 uuids (list, optional): List of Dataset UUIDs string.
934934 dstype (str, optional): Type of Dataset from
935935 `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**.
936942
937943
938944 Returns:
@@ -944,7 +950,7 @@ def getDataSetsValues(self, ids=None, codes=None, uuids=None, dstype=None):
944950 >>> READ.getDataSetsValues(codes=['HOME', 'FIELD'])
945951 >>> READ.getDataSetsValues(uuids=['a6f114f1-5416-4606-ae10-23be32dbc202',
946952 ... '5396fdf3-ceb3-46b6-aaf9-454a37278bb4'])
947- >>> READ.getDataSetsValues(dstype='singleTimeSeries')
953+ >>> READ.getDataSetsValues(dstype='singleTimeSeries', lowercols=False )
948954
949955 """
950956
@@ -955,7 +961,7 @@ def getDataSetsValues(self, ids=None, codes=None, uuids=None, dstype=None):
955961 resids .append (ds .ResultID )
956962
957963 try :
958- return self .getResultValues (resultids = resids )
964+ return self .getResultValues (resultids = resids , lowercols = lowercols )
959965 except Exception as e :
960966 print ('Error running Query {}' .format (e ))
961967 return None
@@ -1338,7 +1344,7 @@ def getResultDerivationEquations(self):
13381344 """
13391345 return self ._session .query (ResultDerivationEquations ).all ()
13401346
1341- def getResultValues (self , resultids , starttime = None , endtime = None ):
1347+ def getResultValues (self , resultids , starttime = None , endtime = None , lowercols = True ):
13421348 """
13431349 Retrieve result values associated with the given result.
13441350
@@ -1347,6 +1353,12 @@ def getResultValues(self, resultids, starttime=None, endtime=None):
13471353 resultids (list): List of SamplingFeatureIDs.
13481354 starttime (object, optional): Start time to filter by as datetime object.
13491355 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**.
13501362
13511363 Returns:
13521364 DataFrame: Pandas dataframe of result values.
@@ -1357,7 +1369,7 @@ def getResultValues(self, resultids, starttime=None, endtime=None):
13571369 >>> READ.getResultValues(resultids=[100, 20, 34], starttime=datetime.today())
13581370 >>> READ.getResultValues(resultids=[1, 2, 3, 4],
13591371 >>> starttime=datetime(2000, 01, 01),
1360- >>> endtime=datetime(2003, 02, 01))
1372+ >>> endtime=datetime(2003, 02, 01), lowercols=False )
13611373
13621374 """
13631375 restype = self ._session .query (Results ).filter_by (ResultID = resultids [0 ]).first ().ResultTypeCV
@@ -1395,7 +1407,14 @@ def getResultValues(self, resultids, starttime=None, endtime=None):
13951407 con = self ._session_factory .engine ,
13961408 params = query .params
13971409 )
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 )
13991418 return df
14001419 except Exception as e :
14011420 print ('Error running Query: {}' .format (e ))
0 commit comments