Commit b82cbfee authored by Klaus Wölfel's avatar Klaus Wölfel

wendelin: add setArrayDtypeNames so that names can be changed from sandbox

parent 218c94e6
...@@ -114,14 +114,14 @@ class DataArray(BigFile): ...@@ -114,14 +114,14 @@ class DataArray(BigFile):
Get numpy array shape Get numpy array shape
""" """
return self.getArray().shape return self.getArray().shape
security.declareProtected(Permissions.AccessContentsInformation, 'getArrayDtype') security.declareProtected(Permissions.AccessContentsInformation, 'getArrayDtype')
def getArrayDtype(self): def getArrayDtype(self):
""" """
Get numpy array dtype Get numpy array dtype
""" """
return self.getArray().dtype return self.getArray().dtype
security.declareProtected(Permissions.AccessContentsInformation, 'getArrayDtypeNames') security.declareProtected(Permissions.AccessContentsInformation, 'getArrayDtypeNames')
def getArrayDtypeNames(self): def getArrayDtypeNames(self):
""" """
...@@ -129,6 +129,13 @@ class DataArray(BigFile): ...@@ -129,6 +129,13 @@ class DataArray(BigFile):
""" """
return self.getArray().dtype.names return self.getArray().dtype.names
security.declareProtected(Permissions.AccessContentsInformation, 'setArrayDtypeNames')
def setArrayDtypeNames(self, names):
"""
Set numpy array dtype names
"""
self.getArray().dtype.names = names
security.declareProtected(Permissions.View, 'index_html') security.declareProtected(Permissions.View, 'index_html')
def index_html(self, REQUEST, RESPONSE, format=_MARKER, inline=_MARKER, **kw): def index_html(self, REQUEST, RESPONSE, format=_MARKER, inline=_MARKER, **kw):
""" """
...@@ -160,7 +167,6 @@ class DataArray(BigFile): ...@@ -160,7 +167,6 @@ class DataArray(BigFile):
index.get('step'))) index.get('step')))
elif start_date is not None and stop_date is not None: elif start_date is not None and stop_date is not None:
import numpy as np import numpy as np
import pandas as pd
start_date_vector = self.getArray()[:]['start_date'] start_date_vector = self.getArray()[:]['start_date']
stop_date_vector = self.getArray()[:]['stop_date'] stop_date_vector = self.getArray()[:]['stop_date']
valid_start_idx = np.where(start_date_vector >= np.datetime64(start_date))[0] valid_start_idx = np.where(start_date_vector >= np.datetime64(start_date))[0]
......
...@@ -46,10 +46,9 @@ ...@@ -46,10 +46,9 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W:133, 42: Redefining built-in \'format\' (redefined-builtin)</string> <string>W:140, 42: Redefining built-in \'format\' (redefined-builtin)</string>
<string>W:183, 4: Redefining built-in \'range\' (redefined-builtin)</string> <string>W:189, 4: Redefining built-in \'range\' (redefined-builtin)</string>
<string>W:210, 10: No exception type(s) specified (bare-except)</string> <string>W:216, 10: No exception type(s) specified (bare-except)</string>
<string>W:163, 8: Unused variable \'pd\' (unused-variable)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment