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