earthkit.data.core.field¶
Classes¶
A class to represent a field in Earthkit. |
Module Contents¶
- class earthkit.data.core.field.Field(*, data=None, time=None, parameter=None, geography=None, vertical=None, ensemble=None, proc=None, labels=None)¶
Bases:
earthkit.data.core.BaseA class to represent a field in Earthkit.
A Field is a horizontal slice of the atmosphere/hydrosphere at a given time.
A Field object is composed of several components:
data: the data values of the field
time: the temporal structure of the field (see
TimeBase)parameter: the parameter of the field (see:
ParameterBase)geography: the geography of the field (see:
GeographyBase)vertical: the vertical structure of the field (see:
VerticalBase)ensemble: the ensemble component of the field (see:
EnsembleBase)proc: the processing component of the field (see:
ProcBase)labels: the labels of the field (see:
SimpleLabels)
Field is not polymorphic, but its components are. The components are meant to be format independent, but they can have format specific implementations with the same interface. For example, the geography component of a GRIB field can have a different implementation than the geography component of a NetCDF field.
Creating Fields¶
To create a new Field object use the factory methods:
from_dict(),from_field()orfrom_components().Values¶
Metadata¶
The metadata of a field can be divided into three categories:
Core component metadata: the metadata that is stored in the components of the field. Each component can be accessed by the corresponding property of the field, such as
timefor the time component. The metadata of a component can be accessed by the methods of the component, e.g.>>> field.time.valid_datetime()
The same metadata can also be accessed by the
get()method of the field with the appropriate key, e.g.>>> field.get("time.valid_datetime") # equivalent to field.time.valid_datetime()
Labels: the “labels” component of the field is a dictionary-like object that can store any user defined key-value pairs. It can be accessed by the
labelsproperty of the field, e.g.>>> field.labels # returns the labels component of the field >>> field.labels["my_key"] # returns the value of label "my_key" >>> field.labels.get("my_key") # equivalent to field.labels["my_key"] >>> field.get("labels.my_key") # equivalent to field.labels["my_key"]
Raw metadata: the field can also store raw metadata that is not part of any component or labels. For example if the field is created from a GRIB message the raw metadata can include all the ecCodes GRIB keys. To access the raw metadata use the
get()method by prefixing the raw metadata key with “metadata.”, e.g.>>> field.get("metadata.shortName")
The same can also be accessed by the
metadatamethod of the field, which is can only access the raw metadata of the field, e.g.>>> field.metadata("shortName") >>> field.metadata("metadata.shortName")
Please not that while
get()has adefaultargument to specify a default value when the key is not found, themetadata()method does not have this argument and will raise a KeyError if the key is not found in the raw metadata.Currently it is not possible to inspect what raw metadata keys are available in a field, but this feature might be added in the future.
Modifying Fields¶
Field arithmetic¶
The Field class supports arithmetic operations such as addition, subtraction, multiplication
- property array_namespace¶
Return the array namespace of the field.
- Type:
ArrayNamespace
- data(keys=('lat', 'lon', 'value'), flatten=False, dtype=None, index=None)¶
Return the values and/or the geographical coordinates for each grid point.
- Parameters:
keys (
str,listortuple) – Specifies the type of data to be returned. Any combination of “lat”, “lon” and “value” is allowed here.flatten (
bool) – When it is True a flat array per key is returned. Otherwise an array with the field’sshapeis returned for each key.dtype (
str,array.dtypeorNone) – Typecode or data-type of the arrays. When it isNonethe default type used by the underlying data accessor is used. For GRIB it isfloat64.index (
array indexing object, optional) – The index of the values and or the latitudes/longitudes to be extracted. When it is None all the values and/or coordinates are extracted.
- Returns:
An multi-dimensional array containing one array per key is returned (following the order in
keys). The underlying array format of the field is used. Whenkeysis a single value only the array belonging to the key is returned.- Return type:
array-like
Examples
How-to examples for the
data()method can be found in the following notebooks:GRIB: getting latitudes, longitudes and values (regular LL grid)
GRIB: getting latitudes, longitudes and values (reduced Gaussian grid)
Other examples:
>>> import earthkit.data as ekd >>> fl = ekd.from_source("file", "docs/how-tos/test6.grib").to_fieldlist() >>> d = fl[0].data() >>> d.shape (3, 7, 12) >>> d[0, 0, 0] # first latitude 90.0 >>> d[1, 0, 0] # first longitude 0.0 >>> d[2, 0, 0] # first value 272.56417847 >>> d = fl[0].data(keys="lon") >>> d.shape (7, 12) >>> d[0, 0] # first longitude 0.0
- describe(component=all, filter=None, **kwargs)¶
Generate dump with all the metadata keys belonging to
namespace.In a Jupyter notebook it is represented as a tabbed interface.
- Parameters:
component (
str,list,tuple,Noneorall) –The component(s) to include. The following values have a special meaning:
all: all the available components will be used.
- **kwargs: dict, optional
Other keyword arguments used for testing only
- Returns:
Dict-like object with one item s per component. In a Jupyter notebook represented as a tabbed interface to browse the dump con stents.
- Return type:
NamespaceDump
See also
namespaceExamples
- classmethod from_components(data=None, values=None, time=None, parameter=None, geography=None, vertical=None, ensemble=None, proc=None, labels=None)¶
Create a Field from components.
- Parameters:
data (
DataFieldComponent,dict) – The data of the field.time (
Time,TimeFieldComponent,dict) – The time of the field.parameter (
Parameter,ParameterFieldComponent,dict) – parameter component in thefield.geography (
Geography,GeographyFieldComponent,dictorNone) – The geography of the field.vertical (
Vertical,VerticalFieldComponent,dictorNone) – The vertical level of the field.ensemble (
Ensemble,EnsembleFieldComponent,dictorNone) – The ensemble specification of the field.proc (
Proc,ProcFieldComponent,dictorNone) – The processing specification of the field.labels (
SimpleLabels,dictorNone) – The labels of the field.
- Returns:
A new Field with the components copied from the original field or specified in the keyword arguments.
- Return type:
- classmethod from_dict(d)¶
Create a Field from a dictionary.
- Parameters:
d (
dict) – The dictionary to create the Field from. Keys not used by any component are added to the labels.- Returns:
A new Field created from the dictionary.
- Return type:
- classmethod from_field(field, data=None, time=None, parameter=None, geography=None, vertical=None, ensemble=None, proc=None, labels=None)¶
Create a Field from another Field.
- Parameters:
field (
Field) – The field to copy from.data (
DataFieldComponent,dictorNone) – The new data of the field. When specified it is used instead of the data in thefieldtime (
TimeBase,TimeFieldComponentHandler,dictorNone) – The new time of the field. When specified it is used instead of the time component in thefield. See:TimeBase.parameter (
ParameterBase,ParameterFieldComponentHandler,dictorNone) – The new parameter of the field. When specified it is used instead of the parameter component in thefield.geography (
GeographyBase,GeographyFieldComponentHandler,dictorNone) – The new geography of the field. When specified it is used instead of the geography component in thefield.vertical (
VerticalBase,VerticalFieldComponentHandler,dictorNone) – The new vertical level of the field. When specified it is used instead of the vertical component in thefield.ensemble (
EnsembleBase,EnsembleFieldComponentHandler,dictorNone) – The new ensemble specification of the field. When specified it is used instead of the ensemble component in thefield.proc (
ProcBase,dict,ProcFieldComponentHandlerorNone) – The new processing specification of the field. When specified it is used instead of the processing component in thefield.labels (
SimpleLabels,dictorNone) – The new labels of the field. When specified it is used instead of the labels in thefield.
- Returns:
A new Field with the components copied from the original field or specified in the keyword arguments.
- Return type:
- property geography¶
Return the geography component of the field.
- Returns:
The geography component of the field.
- Return type:
- get(keys=None, default=None, *, astype=None, raise_on_missing=False, collections=None, output='auto', flatten_dict=False, remapping=None, patch=None)¶
Return the values for the specified keys.
- Parameters:
keys (
str,listortuple) – Specify the field metadata keys to extract. Can be a single key (str) or multiple keys as a list/tuple of str. Keys are assumed to be of the form “component.key”. For example, “time.valid_datetime” or “parameter.name”. Keys from the raw metadata (if any) can be accessed using the “metadata.key” syntax. For example, when aFieldwas created from a GRIB message, the ecCodes GRIB keys can be accessed as “metadata.shortName” or “metadata.level”.default (
Any,None) – Specify the default value(s) forkeys. Returned when the given key is not found andraise_on_missingis False. Whendefaultis a single value, it is used for all the keys. Otherwise it must be a list/tuple of the same length askeys.astype (
type as str,intorfloat) – Return type forkeys. Whenastypeis a single type, it is used for all the keys. Otherwise it must be a list/tuple of the same length askeys. It is only applied to keys returning a single value.raise_on_missing (
bool) – When True, raises KeyError if any ofkeysis not found.collections (
str,listortuple) – Specify the metadata collections to extract. Can be a single collection (str) or multiple collections as a list/tuple of str. A collection is a component of the field (e.g. “time”, “parameter”, “geography”, etc.) as a dictionary. It can also be a collection within the raw “metadata” component. For example, when aFieldwas created from a GRIB message, the ecCodes GRIB “namespaces” can be accessed as collections, e.g. “metadata.mars” means the ecCodes GRIB “mars” namespace. The returned value for a collection is a dictionary with the keys and values in the collection. To flatten the returned dictionary for a collection, use theoutput==dictandflatten_dict=Trueoptions.output (
type,str) –Specify the output type. Can be:
- ”auto” (default):
when
keysis a str returns a single valuewhen
keysis a list/tuple returns a list/tuple of values
list or “list”: returns a list of values.
tuple or “tuple”: returns a tuple of values.
dict or “dict”: returns a dictionary with keys and their values.
Other types are not supported.
flatten_dict (
bool) – When True andoutputis dict, if any of the values in the returned dict is itself a dict, it is flattened to depth 1 by concatenating the keys with a dot. For example, if the returned dict is{"a": {"x": 1, "y": 2}, "b": 3}, it becomes{"a.x": 1, "a.y": 2, "b": 3}. This option is ignored whenoutputis not dict.remapping (
dict, optional) –Create new metadata keys from existing ones. E.g. to define a new key “param_level” as the concatenated value of the “parameter.variable” and “vertical.level” keys use:
remapping={"param_level": "{parameter.variable}{vertical.level}"}
patch (
dict, optional) – A dictionary of patch to be applied to the returned values.
- Returns:
The values for the specified
keys. The structure of the returned value(s) depends on theoutputandflatten_dictparameters.- Return type:
single value,list,tupleordict- Raises:
KeyError – If
raise_on_missingis True and any ofkeysis not found.
Examples
>>> import earthkit.data as ekd >>> f = ekd.from_source("sample", "test.grib").to_fieldlist()[0] >>> f.get("parameter.variable") '2t'
Get multiple keys as a list/tuple of values:
>>> f.get(["parameter.variable", "parameter.units"]) ['2t', 'K'] >>> f.get(("parameter.variable", "parameter.units")) ('2t', 'K')
Get multiple keys as a dictionary:
>>> f.get(["parameter.variable", "parameter.units"], output="dict") {'parameter.variable': '2t', 'parameter.units': 'K'}
Get collections:
>>> f.get(collections="time") {'base_datetime': datetime.datetime(2020, 5, 13, 0, 0), 'step': datetime.timedelta(hours=0), 'valid_datetime': datetime.datetime(2020, 5, 13, 0, 0)} >>> f.get(collections=["time", "parameter"]) [{'base_datetime': datetime.datetime(2020, 5, 13, 0, 0), 'step': datetime.timedelta(hours=0 ), 'valid_datetime': datetime.datetime(2020, 5, 13, 0, 0)}, {'variable': '2t', 'units': 'K'}] >>> f.get(collections=["time", "parameter"], dict=True) {'time': {'base_datetime': datetime.datetime(2020, 5, 13, 0, 0), 'step': datetime.timedelta(hours=0 ), 'valid_datetime': datetime.datetime(2020, 5, 13, 0, 0)}, 'parameter': {'variable': '2t', 'units': 'K'}}
Use
output=dictandflatten_dict=Trueto flatten the returned dictionary for collections:>>> f.get(collections=["time"], output="dict", flatten_dict=True) {'time.base_datetime': datetime.datetime(2020, 5, 13, 0, 0), 'time.step': datetime.timedelta(hours=0), 'time.valid_datetime': datetime.datetime(2020, 5, 13, 0, 0)}
Get the ecCodes GRIB “mars” namespace as a collection from the raw metadata (result trimmed for brevity): >>> f.get(collections=”metadata.mars”, output=”dict”) {“metadata.mars”: {‘class’: ‘od’, ‘date’: 20200513, ‘expver’: ‘0001’}}
Mix keys and collections (result trimmed for brevity):
>>> f.get(keys="metadata.shortName", collections="metadata.mars", output="dict") {'metadata.shortName': '2t', 'metadata.mars': {'class': 'od', 'date': 20200513, 'expver': '0001'}} >>> f.get(keys="metadata.shortName", collections="metadata.mars", output="dict", flatten_dict=True) {'metadata.shortName': '2t', 'metadata.mars.class': 'od', 'metadata.mars.date': 20200513, 'metadata.mars.expver': '0001'}
- head(*args, **kwargs)¶
Generate a one row summary of the Field using a set of metadata keys.
Same as calling
ls.
- property labels¶
Return the labels of the field.
- Returns:
The labels of the field.
- Return type:
- ls(n=None, keys='default', extra_keys=None, collections=None)¶
Generate a one row summary of the Field using a set of metadata keys.
- Parameters:
n (
int,None) – This parameter is ignored since the summary is generated for a single field. It is only used for compatibility with theearthkit.data.core.fieldlist.FieldList.ls()method.keys (
listofstr,dict,None) – The metadata keys to extract. Ifkeys="default", a built-in default set of keys is used. To specify a column title for each key in the output use a dict as a mapping from the keys to the column titles.extra_keys (
listofstr,dict,None) – List of additional keys on top ofkeys. To specify a column title for each key in the output use a dict as a mapping from the keys to the column titles.collections (
str,listofstr,None) – The collections to extract. Can be a single collection (str) or multiple collections as a list of str. A collection is a component of the field (e.g. “time”, “parameter”, “geography”, etc.) as a dictionary. It can also be a collection within the raw “metadata” component. For example, when aFieldwas created from a GRIB message, the ecCodes GRIB “namespaces” can be accessed as collections, e.g. “metadata.mars” means the ecCodes GRIB “mars” namespace.
- Returns:
DataFrame with one row per
Field.- Return type:
Pandas DataFrame
- message()¶
Return a buffer containing the encoded message associated with the field.
Only available for fields generated from a message based format (e.g. GRIB). Once the field metadata is modified by calling
set()the link to the original message is lost and this method will return None.- Return type:
bytes
- metadata(keys, *, astype=None, output='auto', remapping=None, patch=None)¶
Return the raw metadata values.
- Parameters:
keys (
str,listortuple) – Specify the raw metadata keys to extract. Can be a single key (str) or multiple keys as a list/tuple of str. Keys can be optionally prefixed with “metadata.”. For example, if the raw metadata has the key “shortName”, it can also be specified as “metadata.shortName”.astype (
type as str,intorfloat) – Return type forkeys. Whenastypeis a single type, it is used for all the keys. Otherwise it must be a list/tuple of the same length askeys. It is only applied to keys returning a single value.output (
type,str) –Specify the output type. Can be:
- ”auto” (default):
when
keysis a str returns a single valuewhen
keysis a list/tuple returns a list/tuple of values
list or “list”: returns a list of values.
tuple or “tuple”: returns a tuple of values.
dict or “dict”: returns a dictionary with keys and their values.
Other types are not supported.
remapping (
dict, optional) –Create new metadata keys from existing ones. E.g. to define a new key “param_level” as the concatenated value of the “param” and “level” keys use:
remapping={"param_level": "{param}{level}"}
patch (
dict, optional) – A dictionary of patch to be applied to the returned values.
- Returns:
The values for the specified
keys. The structure of the returned value(s) depends on theoutputandflatten_dictparameters.- Return type:
single value,list,tupleordict- Raises:
KeyError – If any of
keysis not found in the raw metadata.
Examples
>>> import earthkit.data as ekd >>> fl = ekd.from_source("sample", "test.grib").to_fieldlist() >>> f = fl[0] >>> f.metadata("shortName") '2t' >>> f.metadata(["shortName", "units"]) ['2t', 'K'] >>> f.metadata(("shortName", "units")) ('2t', 'K')
- property parameter¶
Return the parameter component of the field.
- Returns:
The parameter component of the field.
- Return type:
- property proc¶
Return the proc component of the field.
- Returns:
The proc component of the field.
- Return type:
- set(*args, **kwargs)¶
Return a new field with the specified metadata keys set to the given values.
- Parameters:
*args (
tuple) –Positional arguments used to specify the metadata keys and values to set. Each argument can be a dict with keys and values to set. When multiple dicts are given they are merged together with the latter dicts taking precedence over the former ones.
>>> field.set({"parameter.variable": "t"}) >>> field.set({"parameter.variable": "t", "vertical.level": 1000})
New data values can be set by using the “data” or “values” key with the new values as a value. For example,
>>> field.set(data=new_values_array)
will replace the data values in the field with the values in
new_values_array.Only high-level metadata keys (and “data” or “values”) are allowed here, i.e. keys that belong to a component. Modifying raw metadata keys is not allowed and we cannot use them in
set()with or without the “metadata.” prefix. For example, although in fields generated from GRIB we can use the “metadata.shortName” key in theget()method to access the “shortName” key we cannot use it inset().Entire components can be set by using the component name as a key and the component object or the equivalent dict as a value. For example,
>>> field.set(parameter={"variable": "t", "units": "K"})
will replace the entire parameter component.
Date and time related keys from the “time” field component can take different formats of date/time/duration values as input. For example, when setting by “time.base_datetime” the following calls are equivalent:
>>> fl.set({ "time.base_datetime": "2018-08-01T12"}) >>> fl.set({ "time.base_datetime": datetime(2018, 8, 1, 12, 0) })
Similarly, when setting “time.step” the following calls are equivalent.
>>> fl.set({ "time.step": "6h"}) >>> fl.set({ "time.step": 6}) >>> fl.set({ "time.step": "360m"}) >>> fl.set({ "time.step": timedelta(hours=6)})
Values are assumed to be in hours when the unit is not specified. When the unit is specified it can be either “h”, “m” or “s” for hours, minutes or seconds, respectively.
**kwargs (
dict) – Keyword arguments used to specify the metadata keys and values to set. They take precedence over the positional arguments. The same rules for the keys and values as for the positional arguments apply here.
- Returns:
A new field with the specified metadata keys set to the given values.
- Return type:
Notes
When the field is created from a GRIB message, calling
set()copies the associated GRIB message into the new field without any modifications. Since it is now out of sync with the new field’s components, the new field will not provide access to any GRIB metadata neither viaget()nor viametadata(). Additionally, when callingmessage()on the new field, None is returned. (Usesync()to synchronize the associated GRIB message to the new field and expose the GRIB metadata keys again).>>> import earthkit.data as ekd >>> fl = ekd.from_source("sample", "test.grib").to_fieldlist() >>> f = fl[0] >>> f1 = f.set({"parameter.variable": "msl", "parameter.units": "Pa"}) >>> f1.get("metadata.shortName") None >>> f1.metadata("shortName") KeyError: 'metadata.shortName' not found in field >>> f1.message() None
However, if only the labels or the values are set (the latter via the “data” or “values” keys), the new field returned by
set()is still linked to the original GRIB message and the GRIB specific keys in the raw metadata are still accessible. If the values were modified,message()will return the original GRIB message updated with the modified data values.>>> import earthkit.data as ekd
>>> fl = ekd.from_source("sample", "test.grib").to_fieldlist() >>> f = fl[0] >>> f1 = f.set(values=f.values()+1) >>> f1.get("metadata.shortName") "2t" >>> f1.metadata("shortName") "2t" >>> f1.message() <grib message with modified data values>
Examples
See the how-to examples for the
set()method in the following notebook:Further examples:
>>> import earthkit.data as ekd >>> fl = ekd.from_source("sample", "test.grib").to_fieldlist() >>> f = fl[0] >>> f2 = f.set({"parameter.variable": "10t", "parameter.units": "K"}) >>> f2.get(["parameter.variable", "parameter.units"]) ['10t', 'K']
- property shape¶
Return the shape of the field.
- Type:
tuple
- sync()¶
Return a field with the raw metadata in sync with the field’s components.
When a field is created from a GRIB message, it stores this associated GRIB message/handle and the raw GRIB metadata is extracted from it e.g. when calling
get(). When the field’s components are modified usingset(), the GRIB message is copied into the new field but not modified. Since it is now out of sync with the new field’s components, the new field will not provide access to any GRIB metadata either viaget()or viametadata(). Whensync()is called on such a field the GRIB message is re-encoded using the field’s components and the raw GRIB metadata will become available again and in sync with the field’s components.- Returns:
A field with the raw metadata in sync with the field’s components. If the field is not associated with a GRIB message or if the raw metadata is already in sync, the original field is returned.
- Return type:
Examples
>>> import earthkit.data as ekd >>> fl = ekd.from_source("sample", "test.grib").to_fieldlist() >>> f = fl[0] >>> f1 = f.set({"parameter.variable": "msl", "parameter.units": "Pa"}) >>> f1.get("metadata.shortName") None >>> f1.metadata("shortName") KeyError: 'metadata.shortName' not found in field >>> f2 = f1.sync() >>> f2.get("metadata.shortName") 'msl' >>> f2.metadata("shortName") 'msl'
- tail(*args, **kwargs)¶
Generate a one row summary of the Field using a set of metadata keys.
Same as calling
ls.
- property time¶
Return the time component of the field.
- Returns:
The time component of the field.
- Return type:
- to_array(flatten=False, dtype=None, copy=True, array_namespace=None, device=None, index=None)¶
Return the values stored in the field.
- Parameters:
flatten (
bool) – When it is True a flat array is returned. Otherwise an array with the field’sshapeis returned.dtype (
str,array.dtypeorNone) – Typecode or data-type of the array. When it isNonethe default type used by the underlying data accessor is used. For GRIB it isfloat64.copy (
bool) – When it is True a copy of the data is returned. Otherwise a view is returned where possible.array_namespace (
str,array_namespaceorNone) – The array namespace to be used. When it isNonethe underlying array format of the field is used. New in version 0.19.0.device (
strorNone) – The device where the array will be allocated. When it isNonethe default device is used.index (
array indexing object, optional) – The index of the values to be extracted. When it is None all the values are extracted.
- Returns:
Field values.
- Return type:
array-array
- to_array_field(array_namespace=None, device=None, flatten=False, dtype=None)¶
- to_field(array=True)¶
Return the field itself.
- to_fieldlist(fields=None)¶
- to_numpy(flatten=False, dtype=None, copy=True, index=None)¶
Return the values stored in the field as an ndarray.
- Parameters:
flatten (
bool) – When it is True a flat ndarray is returned. Otherwise an ndarray with the field’sshapeis returned.dtype (
str,numpy.dtypeorNone) – Typecode or data-type of the array. When it isNonethe default type used by the underlying data accessor is used. For GRIB it isfloat64.copy (
bool) – When it is True a copy of the data is returned. Otherwise a view is returned where possible.index (
ndarray indexing object, optional) – The index of the values to be extracted. When it is None all the values are extracted
- Returns:
Field values
- Return type:
ndarray
- to_pandas(*args, **kwargs)¶
Convert the Field into a Pandas DataFrame.
- Parameters:
*args (
tuple) – Positional arguments passed toFieldList.to_pandas.**kwargs (
dict, optional) – Other keyword arguments passed toFieldList.to_pandas.
- Return type:
Pandas DataFrame
- to_target(target, *args, **kwargs)¶
Write the field into a target object.
- Parameters:
target (
object) – The target to write the field into.*args (
tuple) – Positional arguments used to specify the target object.**kwargs (
dict, optional) – Other keyword arguments used to write the field into the target object.
See also
Examples
How-to examples for the
to_target()method can be found in the following notebooks:
- to_xarray(*args, **kwargs)¶
Convert the Field into an Xarray Dataset.
- Parameters:
*args (
tuple) – Positional arguments passed toFieldList.to_xarray.**kwargs (
dict, optional) – Other keyword arguments passed toFieldList.to_xarray.
- Return type:
Xarray Dataset
- property values¶
Return the values of the fields as a flat array.
- Returns:
Flat array containing the field values without performing any copying or conversion. The underlying array format of the field is used. For GRIB it is a numpy array.
- Return type:
array-like
Examples
>>> import earthkit.data as ekd >>> f = ekd.from_source("sample", "test.grib").to_fieldlist()[0] >>> v = f.values >>> v.shape (209,) >>> v[0][:3] array([262.78027344, 267.44726562, 268.61230469])
- property vertical¶
Return the vertical component of the field.
- Returns:
The vertical component of the field.
- Return type: