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





Reply via email to