debug
This commit is contained in:
parent
d0d90f8f7d
commit
2ab03678bf
@ -142,7 +142,7 @@ class ImageAnalyser():
|
||||
}
|
||||
)
|
||||
|
||||
dataSet[self._image_name['OD']].attrs.update(dataSet.attrs)
|
||||
# dataSet[self._image_name['OD']].attrs.update(dataSet.attrs)
|
||||
|
||||
return dataSet
|
||||
|
||||
|
@ -61,6 +61,15 @@ class MongoDB:
|
||||
if not date is None:
|
||||
self.set_date(date)
|
||||
|
||||
data = {
|
||||
'year': self.year,
|
||||
'month': self.month,
|
||||
'day': self.day,
|
||||
'shotNum': shotNum,
|
||||
}
|
||||
|
||||
self.mongoDB['global'].delete_many(data)
|
||||
|
||||
data = {
|
||||
'year': self.year,
|
||||
'month': self.month,
|
||||
@ -91,6 +100,11 @@ class MongoDB:
|
||||
)
|
||||
|
||||
stackedDataArray = self._break_dataSet(dataSet)
|
||||
try:
|
||||
stackedDataArray.load()
|
||||
except:
|
||||
pass
|
||||
|
||||
stackedDataArray = stackedDataArray.groupby('_scanAxis')
|
||||
|
||||
for i in stackedDataArray:
|
||||
@ -133,7 +147,7 @@ class MongoDB:
|
||||
|
||||
self.mongoDB['global'].update_one(filter, {"$set": data}, upsert=False)
|
||||
|
||||
def _add_data_xarray_dataArray(self, shotNum, dataArray, scanAxis=None):
|
||||
def _add_data_xarray_dataArray(self, shotNum, dataArray, name=None, scanAxis=None):
|
||||
|
||||
if scanAxis is None:
|
||||
scanAxis = list(dataArray.coords)
|
||||
@ -255,9 +269,9 @@ class MongoDB:
|
||||
self._add_data_normal(shotNum=shotNum, runNum=runNum, data=data)
|
||||
elif engine == 'xarray':
|
||||
if isinstance(data, type(xr.Dataset())):
|
||||
self._add_data_xarray_dataSet(shotNum=shotNum, data=data, name=name)
|
||||
self._add_data_xarray_dataSet(shotNum=shotNum, dataSet=data, name=name)
|
||||
else:
|
||||
self._add_data_xarray_dataArray(shotNum=shotNum, data=data, name=name)
|
||||
self._add_data_xarray_dataArray(shotNum=shotNum, dataArray=data, name=name)
|
||||
elif engine == 'additional':
|
||||
self._add_data_additional(shotNum=shotNum, runNum=runNum, data=data, name=name)
|
||||
|
||||
@ -293,11 +307,12 @@ class MongoDB:
|
||||
result = {}
|
||||
dropped_attrs = OrderedDict()
|
||||
|
||||
docs = self.mongoDB['global'].find(filter)
|
||||
docs = self.mongoDB['global'].find(filter).sort('runNum')
|
||||
docs = [doc['global_parameters'] for doc in docs]
|
||||
|
||||
for doc in docs:
|
||||
|
||||
global_parameters = doc['global_parameters']
|
||||
global_parameters = doc
|
||||
|
||||
result.update(
|
||||
{
|
||||
@ -322,7 +337,7 @@ class MongoDB:
|
||||
|
||||
for doc in docs:
|
||||
|
||||
global_parameters = doc['global_parameters']
|
||||
global_parameters = doc
|
||||
|
||||
dropped_attrs.update(
|
||||
{
|
||||
@ -333,14 +348,13 @@ class MongoDB:
|
||||
|
||||
scan_attrs = OrderedDict()
|
||||
scan_length = []
|
||||
|
||||
for attrs_key in dropped_attrs.keys():
|
||||
flag = True
|
||||
for key in scan_attrs.keys():
|
||||
if equivalent(scan_attrs[key], dropped_attrs[attrs_key]):
|
||||
flag = False
|
||||
|
||||
result.update({attrs_key: key})
|
||||
|
||||
break
|
||||
if flag:
|
||||
scan_attrs.update({
|
||||
@ -381,7 +395,7 @@ class MongoDB:
|
||||
if field is None:
|
||||
field = globalDict
|
||||
|
||||
res = field
|
||||
res = {}
|
||||
|
||||
for key in field:
|
||||
if isinstance(globalDict[key], dict) and ('mongoID' in globalDict[key]):
|
||||
|
5130
testMongoDB.ipynb
5130
testMongoDB.ipynb
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user