Re: Surface properties

2024-02-05 Thread leopio . dadderio

Hi Patrick,

I fixed the issue about the Griddedfield2, thanks. Now, I am trying to
get the output of both surfaceTessem and surfaceTelsem (according to
the surface type), since I am interested to the surface emissivity. I
did the following in my code:

ws.ArrayOfStringSet(ws.iy_aux_vars, ["Radiative background"])

RadBack=ws.y_aux.value[0]

My feeling is that I am wrong, but I supposed that the surfaceTessem
(or surfaceTelsem) outputs were in auxiliary variables.


In addition, is there a way to skip simulations that would stop by any
error in ARTS? Could I add "robust=1" in yCalc?
For some simulations, I get the following error message:
Run-time error in method: ppathStepByStep
User Error:
Please follow these instructions to correct your error:
The path exits the atmosphere through the upper longitude end face.
The exit point is at an altitude of 44.5297 km.

Could you help me on this? Many thanks.

Best,
Leo Pio






Leo,

Assuming you are using pyarts, you find documentation here:

https://atmtools.github.io/arts-docs-master/stubs/pyarts.arts.GriddedField2.html#pyarts.arts.GriddedField2

See especially point 3 under __init__.


For completeness, if using xarray here is another option:

https://atmtools.github.io/arts-docs-master/stubs/pyarts.arts_ext.GriddedFieldExtras.from_xarray.html#pyarts.arts_ext.GriddedFieldExtras.from_xarray

Bye,

Patrick


On 2024-01-18 17:21, leopio.dadde...@artov.isac.cnr.it wrote:

Dear Patrick,

many thanks for your reply. Anyway, Ithink I was not too clear. I
am working with matrix skin temperature (as well as for wind at 10
m or land/ocean mask). I read both skin temperature and wind from
ERA5 data, so the data change according to my needs (obviously, the
land/ocean mask is always the same). Your code is designed only for
scalar constant skin temperature value. Is it correct?

Thanks,
Leo Pio





Dear Leo Pio,

Below, you find Python code that you can use if you are working
with scalar skin_temperatures. Otherwise, I assume this is enough
for you to make a more general method.

Bye,

Patrick


def GriddedField2GloballyConstant(
    ws: Workspace,
    name: str,
    value: float,
) -> None:
    """
    Sets a WSV of type GriddedField2Create to hold a constant value.

    The WSV is assumed to represent geographical data, and the
dimensions are set
    to Latitude and Longitude. The data are defined to cover the complete
    planet.

    :param ws: Workspace.
    :param name:   Name of WSV to fill.
    :param value:  Fill value.
    """

    gf2 = pa.GriddedField2()
    gf2.gridnames = ["Latitude", "Longitude"]
    gf2.grids = [np.array([-90, 90]), np.array([-180, 360])]
    gf2.data = np.full((2, 2), value)
    gf2.name = "Generated by easy arts function gf2_constant_set"
    setattr(ws, name, gf2)


On 2024-01-17 10:08, leopio.dadde...@artov.isac.cnr.it wrote:

Dear ARTS community,

within my simulation, I am setting the surface properties. In
particular, when I use Tessem and Telsem model to calculate
emissivity and reflectivity of ocean and land, respectively, I
need as input the wind at 10m, the skin temperature, a land/ocean
mask (among the others). I read these variable from NetCDF files
using python (i.e. NetCDF4 and Numpy).
In the related agenda, I use "InterpGriddedField2ToPosition"
which requires a "GriddedField2" variable (i.e. skin temperature,
or wind) as input. To create this variable, I do the following
(for instance eith skin temperature):

ws.GriddedField2Create("SkinTemperature")
ws.Copy(ws.skinTemperature,skinTemperature)

At this point, I get the following error:
"Could not convert input [here there are the values of the skin
temperature matrix] to expected group GriddedField2."

Where am I wrong? "Copy" is a method to fill a GriddedField2 variable.

I hope I was clear, any help is welcomed. Thanks.

Leo Pio















Re: Surface properties

2024-01-19 Thread Patrick Eriksson

Leo,

Assuming you are using pyarts, you find documentation here:

https://atmtools.github.io/arts-docs-master/stubs/pyarts.arts.GriddedField2.html#pyarts.arts.GriddedField2

See especially point 3 under __init__.


For completeness, if using xarray here is another option:

https://atmtools.github.io/arts-docs-master/stubs/pyarts.arts_ext.GriddedFieldExtras.from_xarray.html#pyarts.arts_ext.GriddedFieldExtras.from_xarray

Bye,

Patrick


On 2024-01-18 17:21, leopio.dadde...@artov.isac.cnr.it wrote:

Dear Patrick,

many thanks for your reply. Anyway, Ithink I was not too clear. I am 
working with matrix skin temperature (as well as for wind at 10 m or 
land/ocean mask). I read both skin temperature and wind from ERA5 data, 
so the data change according to my needs (obviously, the land/ocean mask 
is always the same). Your code is designed only for scalar constant skin 
temperature value. Is it correct?


Thanks,
Leo Pio





Dear Leo Pio,

Below, you find Python code that you can use if you are working with 
scalar skin_temperatures. Otherwise, I assume this is enough for you 
to make a more general method.


Bye,

Patrick


def GriddedField2GloballyConstant(
    ws: Workspace,
    name: str,
    value: float,
) -> None:
    """
    Sets a WSV of type GriddedField2Create to hold a constant value.

    The WSV is assumed to represent geographical data, and the 
dimensions are set

    to Latitude and Longitude. The data are defined to cover the complete
    planet.

    :param ws: Workspace.
    :param name:   Name of WSV to fill.
    :param value:  Fill value.
    """

    gf2 = pa.GriddedField2()
    gf2.gridnames = ["Latitude", "Longitude"]
    gf2.grids = [np.array([-90, 90]), np.array([-180, 360])]
    gf2.data = np.full((2, 2), value)
    gf2.name = "Generated by easy arts function gf2_constant_set"
    setattr(ws, name, gf2)


On 2024-01-17 10:08, leopio.dadde...@artov.isac.cnr.it wrote:

Dear ARTS community,

within my simulation, I am setting the surface properties. In 
particular, when I use Tessem and Telsem model to calculate 
emissivity and reflectivity of ocean and land, respectively, I need 
as input the wind at 10m, the skin temperature, a land/ocean mask 
(among the others). I read these variable from NetCDF files using 
python (i.e. NetCDF4 and Numpy).
In the related agenda, I use "InterpGriddedField2ToPosition" which 
requires a "GriddedField2" variable (i.e. skin temperature, or wind) 
as input. To create this variable, I do the following (for instance 
eith skin temperature):


ws.GriddedField2Create("SkinTemperature")
ws.Copy(ws.skinTemperature,skinTemperature)

At this point, I get the following error:
"Could not convert input [here there are the values of the skin 
temperature matrix] to expected group GriddedField2."


Where am I wrong? "Copy" is a method to fill a GriddedField2 variable.

I hope I was clear, any help is welcomed. Thanks.

Leo Pio











Re: Surface properties

2024-01-18 Thread leopio . dadderio
I forgot to say that the variables are "ndarray" after reading them  
from netCDF files and their shape is 721x1440. Do have they to be of a  
particular type (e.g., ndarray, masked array, xarray, etc.) to fill a  
GriddedField2 variable? Or, do they have a particular shape?


Leo Pio


Dear Patrick,

many thanks for your reply. Anyway, Ithink I was not too clear. I am  
working with matrix skin temperature (as well as for wind at 10 m or  
land/ocean mask). I read both skin temperature and wind from ERA5  
data, so the data change according to my needs (obviously, the  
land/ocean mask is always the same). Your code is designed only for  
scalar constant skin temperature value. Is it correct?


Thanks,
Leo Pio





Dear Leo Pio,

Below, you find Python code that you can use if you are working  
with scalar skin_temperatures. Otherwise, I assume this is enough  
for you to make a more general method.


Bye,

Patrick


def GriddedField2GloballyConstant(
   ws: Workspace,
   name: str,
   value: float,
) -> None:
   """
   Sets a WSV of type GriddedField2Create to hold a constant value.

   The WSV is assumed to represent geographical data, and the  
dimensions are set

   to Latitude and Longitude. The data are defined to cover the complete
   planet.

   :param ws: Workspace.
   :param name:   Name of WSV to fill.
   :param value:  Fill value.
   """

   gf2 = pa.GriddedField2()
   gf2.gridnames = ["Latitude", "Longitude"]
   gf2.grids = [np.array([-90, 90]), np.array([-180, 360])]
   gf2.data = np.full((2, 2), value)
   gf2.name = "Generated by easy arts function gf2_constant_set"
   setattr(ws, name, gf2)


On 2024-01-17 10:08, leopio.dadde...@artov.isac.cnr.it wrote:

Dear ARTS community,

within my simulation, I am setting the surface properties. In  
particular, when I use Tessem and Telsem model to calculate  
emissivity and reflectivity of ocean and land, respectively, I  
need as input the wind at 10m, the skin temperature, a land/ocean  
mask (among the others). I read these variable from NetCDF files  
using python (i.e. NetCDF4 and Numpy).
In the related agenda, I use "InterpGriddedField2ToPosition" which  
requires a "GriddedField2" variable (i.e. skin temperature, or  
wind) as input. To create this variable, I do the following (for  
instance eith skin temperature):


ws.GriddedField2Create("SkinTemperature")
ws.Copy(ws.skinTemperature,skinTemperature)

At this point, I get the following error:
"Could not convert input [here there are the values of the skin  
temperature matrix] to expected group GriddedField2."


Where am I wrong? "Copy" is a method to fill a GriddedField2 variable.

I hope I was clear, any help is welcomed. Thanks.

Leo Pio











Re: Surface properties

2024-01-18 Thread leopio . dadderio

Dear Patrick,

many thanks for your reply. Anyway, Ithink I was not too clear. I am  
working with matrix skin temperature (as well as for wind at 10 m or  
land/ocean mask). I read both skin temperature and wind from ERA5  
data, so the data change according to my needs (obviously, the  
land/ocean mask is always the same). Your code is designed only for  
scalar constant skin temperature value. Is it correct?


Thanks,
Leo Pio





Dear Leo Pio,

Below, you find Python code that you can use if you are working with  
scalar skin_temperatures. Otherwise, I assume this is enough for you  
to make a more general method.


Bye,

Patrick


def GriddedField2GloballyConstant(
ws: Workspace,
name: str,
value: float,
) -> None:
"""
Sets a WSV of type GriddedField2Create to hold a constant value.

The WSV is assumed to represent geographical data, and the  
dimensions are set

to Latitude and Longitude. The data are defined to cover the complete
planet.

:param ws: Workspace.
:param name:   Name of WSV to fill.
:param value:  Fill value.
"""

gf2 = pa.GriddedField2()
gf2.gridnames = ["Latitude", "Longitude"]
gf2.grids = [np.array([-90, 90]), np.array([-180, 360])]
gf2.data = np.full((2, 2), value)
gf2.name = "Generated by easy arts function gf2_constant_set"
setattr(ws, name, gf2)


On 2024-01-17 10:08, leopio.dadde...@artov.isac.cnr.it wrote:

Dear ARTS community,

within my simulation, I am setting the surface properties. In  
particular, when I use Tessem and Telsem model to calculate  
emissivity and reflectivity of ocean and land, respectively, I need  
as input the wind at 10m, the skin temperature, a land/ocean mask  
(among the others). I read these variable from NetCDF files using  
python (i.e. NetCDF4 and Numpy).
In the related agenda, I use "InterpGriddedField2ToPosition" which  
requires a "GriddedField2" variable (i.e. skin temperature, or  
wind) as input. To create this variable, I do the following (for  
instance eith skin temperature):


ws.GriddedField2Create("SkinTemperature")
ws.Copy(ws.skinTemperature,skinTemperature)

At this point, I get the following error:
"Could not convert input [here there are the values of the skin  
temperature matrix] to expected group GriddedField2."


Where am I wrong? "Copy" is a method to fill a GriddedField2 variable.

I hope I was clear, any help is welcomed. Thanks.

Leo Pio











Re: Surface properties

2024-01-17 Thread Patrick Eriksson

Dear Leo Pio,

Below, you find Python code that you can use if you are working with 
scalar skin_temperatures. Otherwise, I assume this is enough for you to 
make a more general method.


Bye,

Patrick


def GriddedField2GloballyConstant(
ws: Workspace,
name: str,
value: float,
) -> None:
"""
Sets a WSV of type GriddedField2Create to hold a constant value.

The WSV is assumed to represent geographical data, and the 
dimensions are set

to Latitude and Longitude. The data are defined to cover the complete
planet.

:param ws: Workspace.
:param name:   Name of WSV to fill.
:param value:  Fill value.
"""

gf2 = pa.GriddedField2()
gf2.gridnames = ["Latitude", "Longitude"]
gf2.grids = [np.array([-90, 90]), np.array([-180, 360])]
gf2.data = np.full((2, 2), value)
gf2.name = "Generated by easy arts function gf2_constant_set"
setattr(ws, name, gf2)


On 2024-01-17 10:08, leopio.dadde...@artov.isac.cnr.it wrote:

Dear ARTS community,

within my simulation, I am setting the surface properties. In 
particular, when I use Tessem and Telsem model to calculate emissivity 
and reflectivity of ocean and land, respectively, I need as input the 
wind at 10m, the skin temperature, a land/ocean mask (among the others). 
I read these variable from NetCDF files using python (i.e. NetCDF4 and 
Numpy).
In the related agenda, I use "InterpGriddedField2ToPosition" which 
requires a "GriddedField2" variable (i.e. skin temperature, or wind) as 
input. To create this variable, I do the following (for instance eith 
skin temperature):


ws.GriddedField2Create("SkinTemperature")
ws.Copy(ws.skinTemperature,skinTemperature)

At this point, I get the following error:
"Could not convert input [here there are the values of the skin 
temperature matrix] to expected group GriddedField2."


Where am I wrong? "Copy" is a method to fill a GriddedField2 variable.

I hope I was clear, any help is welcomed. Thanks.

Leo Pio