Exemplo n.º 1
0
    def denetcdf(self, group):
        """ Sets this based on a netcdf group
        
        Input:
            Group of data that can be interpreted as this's information
        """
        self.col_range.denetcdf(group, "col_range")
        self.row_range.denetcdf(group, "row_range")
        self.indices = np.array(group["indices"])

        if group.MatrixType == "Matrix":
            x = Matrix()
        else:
            x = Sparse()
        x.denetcdf(group)
        self.data = x
Exemplo n.º 2
0
 def __init__(self, type="Interp", data=Matrix()):
     if isinstance(type, c.c_void_p):
         self.__delete__ = False
         self.__data__ = type
     else:
         self.__delete__ = True
         self.__data__ = c.c_void_p(lib.createPartitionFunctionsData())
         self.type = type
         self.data = data
Exemplo n.º 3
0
 def data(self):
     if self.type == 0:
         x = lib.getget_denseBlock(self.__data__)
         if x:
             return Matrix(c.c_void_p(x))
         else:
             raise RuntimeError("No data")
     elif self.type == 1:
         x = lib.getget_sparseBlock(self.__data__)
         if x:
             return Sparse(c.c_void_p(x))
         else:
             raise RuntimeError("No data")
     else:
         raise TypeError("Cannot understand self's type")
Exemplo n.º 4
0
 def transformation(self):
     """ (Matrix) """
     return Matrix(
         c.c_void_p(lib.getTransformationRetrievalQuantity(self.__data__)))
Exemplo n.º 5
0
assert gf1.OK
assert gf2.OK
assert gf3.OK
assert gf4.OK
assert gf5.OK
assert gf6.OK

gf1.grids = [Vector([1,2,3])]
assert not gf1.OK
gf1.data = Vector([5,4,3])
assert gf1.OK

gf2.grids = [Vector([1,2,3]), ArrayOfString([String("Hej"), String("hopp")])]
assert not gf2.OK
gf2.data = Matrix([[1, 2], [3, 4], [5, 6]])
assert gf2.OK

gf3.data = Tensor3(np.zeros((5, 3, 2)))
assert not gf3
assert not gf3.OK
gf3.grids = [Vector(np.linspace(0, 1, 5)), Vector(np.linspace(0, 1, 3)), Vector(Vector(np.linspace(0, 1, 2)))]
assert gf3.OK

gf4.data = Tensor4(np.zeros((5, 3, 2, 4)))
assert not gf4
assert not gf4.OK
gf4.grids = [Vector(np.linspace(0, 1, 5)), Vector(np.linspace(0, 1, 3)), Vector(np.linspace(0, 1, 2)), Vector(np.linspace(0, 1, 4))]
assert gf4.OK

gf5.data = Tensor5(np.zeros((5, 3, 2, 4)))
Exemplo n.º 6
0
 def w2(self):
     """ (Matrix) """
     return Matrix(c.c_void_p(lib.getw2TessemNN(self.__data__)))
Exemplo n.º 7
0
import numpy as np

from pyarts.classes.Vector import Vector
from pyarts.classes.Matrix import Matrix
from pyarts.classes.Tensor3 import Tensor3
from pyarts.classes.Tensor4 import Tensor4
from pyarts.classes.Tensor5 import Tensor5
from pyarts.classes.Tensor6 import Tensor6
from pyarts.classes.Tensor7 import Tensor7

t1 = Vector()
t2 = Matrix()
t3 = Tensor3()
t4 = Tensor4()
t5 = Tensor5()
t6 = Tensor6()
t7 = Tensor7()

assert not t1
assert not t2
assert not t3
assert not t4
assert not t5
assert not t6
assert not t7

n = int(np.random.permutation(np.linspace(1, 10, 10))[0])
t1.data = np.random.normal(size=(n, ))
t2.data = np.random.normal(size=(n, n))
t3.data = np.random.normal(size=(n, n, n))
t4.data = np.random.normal(size=(n, n, n, n))
Exemplo n.º 8
0
 def g_lookup(self):
     """ (Matrix) """
     return Matrix(c.c_void_p(lib.getGMCAntenna(self.__data__)))
Exemplo n.º 9
0
 def emis(self):
     """ Emissivities (Matrix) """
     return Matrix(c.c_void_p(lib.getEmisTelsemAtlas(self.__data__)))
Exemplo n.º 10
0
 def pos(self):
     """ The distance between start pos and the last position in pos (Matrix) """
     return Matrix(c.c_void_p(lib.getposPpath(self.__data__)))
Exemplo n.º 11
0
 def data(self):
     """ The data (Matrix) """
     return Matrix(c.c_void_p(lib.dataGriddedField2(self.__data__)))
Exemplo n.º 12
0
 def data(self):
     return Matrix(c.c_void_p(lib.getdataPartitionFunctionsData(self.__data__)))
Exemplo n.º 13
0
from pyarts.classes.RadiationVector import RadiationVector
from pyarts.classes.TransmissionMatrix import TransmissionMatrix
from pyarts.classes.Matrix import Matrix
from pyarts.classes.Vector import Vector

tm = TransmissionMatrix(4, 4)
tm[0] = Matrix([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])
tm[1] = Matrix([[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])
tm[2] = Matrix([[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]])
tm[3] = Matrix([[1, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]])

tm2 = TransmissionMatrix()
tm2.set(tm)
assert tm == tm2

rv = RadiationVector(4, 4)
rv[0] = Vector([0, 0, 0, 0])
rv[1] = Matrix([1, 0, 0, 0])
rv[2] = Matrix([0, 1, 0, 0])
rv[3] = Matrix([0, 0, 1, 1])

rv2 = RadiationVector()
rv2.set(rv)
assert rv == rv2

tm3 = TransmissionMatrix()
rv3 = RadiationVector()

tm.savexml("tmp.tm.xml", "binary")
rv.savexml("tmp.rv.xml", "binary")
Exemplo n.º 14
0
 def emis_err(self):
     """ Emissivity uncertainties (Matrix) """
     return Matrix(c.c_void_p(lib.getEmis_errTelsemAtlas(self.__data__)))
Exemplo n.º 15
0
 def vmrs(self):
     """ The reference VMR profiles (Matrix) """
     return Matrix(c.c_void_p(lib.getVMRsGasAbsLookup(self.__data__)))
Exemplo n.º 16
0
from pyarts.classes.Vector import Vector
from pyarts.classes.Matrix import Matrix
from pyarts.classes.MCAntenna import MCAntenna
from pyarts.classes import from_workspace

ws = Workspace()

mca = MCAntenna()

mca.type = 1
mca.type = 2
mca.type = 3

mca.sigma_aa = 4.5
mca.sigma_za = 4.5

mca.aa_grid = Vector([1, 2, 3, 4])
mca.za_grid = Vector([1, 2, 3, 4, 5])
mca.g_lookup = Matrix([[5, 6, 7, 8], [5, 6, 7, 8], [5, 6, 7, 8], [5, 6, 7, 8],
                       [5, 6, 7, 8]])

mca2 = from_workspace(ws.mc_antenna)
mca2.set(mca)

assert mca2 == mca

# mca3 = MCAntenna()
# mca.savexml("tmp.mca.xml", "binary")
# mca3.readxml("tmp.mca.xml")
# assert mca3 == mca
Exemplo n.º 17
0
 def los(self):
     """ Line-of-sight at each ppath point (Matrix) """
     return Matrix(c.c_void_p(lib.getlosPpath(self.__data__)))