.. _wildcard-fields:

***************
Wildcard Fields
***************

Fides supports Wildcard fields which are mostly useful for the data model generation, but can be used in user-created data models as well.
This allows for specifying some basic information about variables in the data model, while allowing the names of the associated variables and their cell/point associations to be specified in ADIOS Attributes.

.. list-table:: Wildcard Field Attributes
   :header-rows: 1

   * - Attribute Name
     - Possible types/values
     - Required
   * - ``Fides_Variable_List``
     - vector\<string\>: variable names
     - yes
   * - ``Fides_Variable_Associations``
     - vector\<string\>: variable associations
     - yes
   * - ``Fides_Variable_Sources``
     - vector\<string\>: variable data sources
     - only for XGC
   * - ``Fides_Variable_Array_Types``
     - vector\<string\>: variable array types
     - only for XGC

**Example JSON**

If using wildcard fields in your own data model (i.e., not generated by Fides), a wildcard field looks like this (except for XGC):

.. code-block:: json

    {
        "fields": [
            {
                "variable_list_attribute_name": "Fides_Variable_List",
                "variable_association_attribute_name": "Fides_Variable_Associations",
                "array": {
                    "array_type": "basic",
                    "data_source": "source",
                    "variable": ""
                }
            }
        ]
    }

So in your Attributes, you will need an attribute called ``Fides_Variable_List`` which is a vector of variable names that you want Fides to read.
Then the attribute ``Fides_Variable_Associations`` is a vector of those variables associations. Each entry should be either ``points`` or ``cell_set``.

For an XGC data model, the field will look like:

.. code-block:: json

    {
        "fields": [
            {
                "variable_list_attribute_name": "Fides_Variable_List",
                "variable_association_attribute_name": "Fides_Variable_Associations",
                "variable_sources_attribute_name": "Fides_Variable_Sources",
                "variable_arrays_attribute_name": "Fides_Variable_Array_Types",
                "array": {
                    "array_type": "",
                    "data_source": "",
                    "variable": ""
                }
            }
        ]
    }

Since XGC has multiple data sources as well as some special handling for certain variables, two additional Attributes are needed.
The attribute ``Fides_Variable_Sources`` should have the source name for each variable in ``Fides_Variable_List``.
The value for each entry with be either ``mesh`` or ``3d``, depending on whether the variable is contained in the xgc.mesh.bp or xgc.3d.bp data sets, respectively.
The entries in attribute ``Fides_Variable_Array_Type``, will be ``basic`` if it's a variable that is for a single plane (e.g., ``pot0``) or ``xgc_field`` if it's for all planes (e.g., ``dpot``).
