Ejemplo n.º 1
0
 def grids(self):
     types = self.gridtypes
     x = []
     for i in range(self.dim):
         if types[i] == 0:
             x.append(Vector(c.c_void_p(lib.get_numeric_gridGriddedField5(int(i), self.__data__))))
         else:
             x.append(ArrayOfString(c.c_void_p(lib.get_string_gridGriddedField5(int(i), self.__data__))))
     return x
Ejemplo n.º 2
0
    def from_xarray(cls, ds):
        """Set XsecRecord from xarray dataset"""
        xr = cls()
        coeff_grid = ArrayOfString(["p00", "p10", "p01", "p20"])
        gfs = []
        xr.spec = ds.attrs["species"]
        xr.version = ds.attrs["version"]
        xr.fitminpressures = ds["fitminpressures"]
        xr.fitmaxpressures = ds["fitmaxpressures"]
        xr.fitmintemperatures = ds["fitmintemperatures"]
        xr.fitmaxtemperatures = ds["fitmaxtemperatures"]
        for i in ds["bands"].values:
            g = GriddedField2()
            g.gridnames = ["frequency grid [Hz]", "fit coefficients [m]"]
            g.grids = [Vector(ds[f"band{i}_fgrid"].values), coeff_grid]
            g.data = ds[f"band{i}_coeffs"].values
            gfs.append(g)
        xr.fitcoeffs = ArrayOfGriddedField2(gfs)

        return xr
Ejemplo n.º 3
0
 def x_min(self):
     """ (Vector) """
     return Vector(c.c_void_p(lib.getx_minTessemNN(self.__data__)))
Ejemplo n.º 4
0
 def r(self):
     """ Radius of each ppath point (Vector) """
     return Vector(c.c_void_p(lib.getrPpath(self.__data__)))
Ejemplo n.º 5
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))
Ejemplo n.º 6
0
 def nls_pert(self):
     """ The vector of perturbations for the VMRs of the nonlinear species (Vector) """
     return Vector(c.c_void_p(lib.getNLSPertGasAbsLookup(self.__data__)))
Ejemplo n.º 7
0
 def p_grid(self):
     """ The pressure grid for the table [Pa] (Vector) """
     return Vector(c.c_void_p(lib.getPgridGasAbsLookup(self.__data__)))
Ejemplo n.º 8
0
assert not gf1
assert not gf2
assert not gf3
assert not gf4
assert not gf5
assert not gf6

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
Ejemplo n.º 9
0
 def end_pos(self):
     """ End position (Vector) """
     return Vector(c.c_void_p(lib.getend_posPpath(self.__data__)))
Ejemplo n.º 10
0
 def ref_temperature(self):
     """ Reference temperature (Vector) """
     return Vector(
         c.c_void_p(lib.getRefTemperatureXsecRecord(self.__data__)))
Ejemplo n.º 11
0
 def data(self):
     """ The data (Vector) """
     return Vector(c.c_void_p(lib.dataGriddedField1(self.__data__)))
Ejemplo n.º 12
0
 def coeffs(self):
     """ Coefficients (Vector) """
     return Vector(c.c_void_p(lib.getCoeffsXsecRecord(self.__data__)))
Ejemplo n.º 13
0
 def ref_pressure(self):
     """ Reference pressure (Vector) """
     return Vector(c.c_void_p(lib.getRefPressureXsecRecord(self.__data__)))
Ejemplo n.º 14
0
 def ngroup(self):
     """ The group index of refraction (Vector) """
     return Vector(c.c_void_p(lib.getngroupPpath(self.__data__)))
Ejemplo n.º 15
0
 def nreal(self):
     """ The real part of the refractive index at each path position (Vector) """
     return Vector(c.c_void_p(lib.getnrealPpath(self.__data__)))
Ejemplo n.º 16
0
 def end_los(self):
     """ End line-of-sight (Vector) """
     return Vector(c.c_void_p(lib.getend_losPpath(self.__data__)))
Ejemplo n.º 17
0
 def y_max(self):
     """ (Vector) """
     return Vector(c.c_void_p(lib.gety_maxTessemNN(self.__data__)))
Ejemplo n.º 18
0
 def offset(self):
     """ (Vector) """
     return Vector(c.c_void_p(lib.getOffsetRetrievalQuantity(
         self.__data__)))
Ejemplo n.º 19
0
 def b2(self):
     """ (Vector) """
     return Vector(c.c_void_p(lib.getb2TessemNN(self.__data__)))
Ejemplo n.º 20
0
 def t_ref(self):
     """ The reference temperature profile [K] (Vector) """
     return Vector(c.c_void_p(lib.getTrefGasAbsLookup(self.__data__)))
Ejemplo n.º 21
0
 def t_func_parameters(self):
     """ (Vector) """
     return Vector(
         c.c_void_p(lib.getTFuncParametersRetrievalQuantity(self.__data__)))
Ejemplo n.º 22
0
 def lstep(self):
     """ The length between ppath points (Vector) """
     return Vector(c.c_void_p(lib.getlstepPpath(self.__data__)))
Ejemplo n.º 23
0
 def log_p_grid(self):
     """ The natural log of the pressure grid (Vector) """
     return Vector(c.c_void_p(lib.getLogPgridGasAbsLookup(self.__data__)))
Ejemplo n.º 24
0
 def za_grid(self):
     """ (Vector) """
     return Vector(
         c.c_void_p(lib.getza_gridSingleScatteringData(self.__data__)))
Ejemplo n.º 25
0
 def t_pert(self):
     """ The vector of temperature perturbations [K] (Vector) """
     return Vector(c.c_void_p(lib.getTpertGasAbsLookup(self.__data__)))
Ejemplo n.º 26
0
 def energies(self):
     """ Energy data (Vector) """
     return Vector(c.c_void_p(lib.getEnergiesEnergyLevelMap(self.__data__)))
Ejemplo n.º 27
0
 def f_grid(self):
     """ The frequency grid [Hz] (Vector) """
     return Vector(c.c_void_p(lib.getFgridGasAbsLookup(self.__data__)))
Ejemplo n.º 28
0
 def za_grid(self):
     """ (Vector) """
     return Vector(c.c_void_p(lib.getzagMCAntenna(self.__data__)))
Ejemplo n.º 29
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
Ejemplo n.º 30
0
from pyarts.workspace import Workspace
from pyarts.classes.XsecRecord import XsecRecord
from pyarts.classes.Vector import Vector, ArrayOfVector
from pyarts.classes import from_workspace

xr = XsecRecord()
xr2 = XsecRecord()

xr.spec = 1
xr.coeffs = 2
xr.ref_pressure = 3
xr.ref_temperature = 4
xr.fgrids = ArrayOfVector([Vector([5, 6])])
xr.xsecs = ArrayOfVector([Vector([7, 8])])
xr.temperature_slope = ArrayOfVector([Vector([9, 10])])
xr.temperature_intersect = ArrayOfVector([Vector([11, 12])])

xr2.set(xr)
assert xr == xr2

xr3 = XsecRecord()
xr.savexml("tmp.xr.xml", "binary")
xr3.readxml("tmp.xr.xml")
assert xr3 == xr