Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trial inspect call for emitting warnings #279

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pyVlsv/vlsvreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1716,16 +1716,24 @@ def read_variable_to_cache(self, name, operator="pass"):
# Also initialize the fileindex dict at the same go because it is very likely something you want to have for accessing cached values
self.__read_fileindex_for_cellid()

def read_variable(self, name, cellids=-1,operator="pass"):
def read_variable(self, name, cellids=-1,operator="pass",sorted=False):
''' Read variables from the open vlsv file.
Arguments:
:param name: Name of the variable
:param cellids: a value of -1 reads all data
:param operator: Datareduction operator. "pass" does no operation on data
:param sorted: Return values sorted by CellID (default: file order for vg, 3D array for fsgrid)
:returns: numpy array with the data

.. seealso:: :func:`read` :func:`read_variable_info`
'''

import inspect

stck = inspect.stack()
if(inspect.getmodule(stck[1][0]) is None or (inspect.getmodule(stck[1][0]) is not None and inspect.getmodule(stck[1][0]).__name__ == '__main__')):
warnings.warn("Calling read_variable returns data in file layout order. Remember to argsort with CellID or consider using read_variable_info instead!")

cellids = get_data(cellids)

# Wrapper, check if requesting an fsgrid variable
Expand Down
2 changes: 2 additions & 0 deletions pytools.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
logging.info('either using csc.taito.fi without loading the mayavi2 module, or by invoking')
logging.info('the system python interpeter by calling "./scriptname.py" instead of "python ./scriptname.py"')

logging.getLogger('matplotlib').setLevel(logging.WARNING)

# Run TeX typesetting through the full TeX engine instead of python's own mathtext. Allows
# for changing fonts, bold math symbols etc, but may cause trouble on some systems.
if not os.getenv('PTNOLATEX'):
Expand Down
Loading