source: codes/icosagcm/devel/Python/dynamico/dev/precision.py @ 825

Last change on this file since 825 was 825, checked in by dubos, 5 years ago

devel/Python : moved Fortran bindings and *.pyx to dynamico/dev module + necessary changes to test/py/*.py

File size: 349 bytes
Line 
1"Helper function to manage mixed precision"
2import numpy as np
3from unstructured import np_num
4
5zero=np_num(0.)
6
7# cast array to float/double depending on CPP_MIXED_PREC
8def asnum(data): return [ x.astype(np_num) for x in data] if type(data) is list else data.astype(np_num)
9
10def zeros(dims): return np.zeros([n for n in dims if n>1], dtype=np_num)
Note: See TracBrowser for help on using the repository browser.