rompy.schism.data.SCHISMDataSflux#

pydantic model rompy.schism.data.SCHISMDataSflux[source]#

Show JSON schema
{
   "title": "SCHISMDataSflux",
   "type": "object",
   "properties": {
      "data_type": {
         "const": "sflux",
         "default": "sflux",
         "description": "Model type discriminator",
         "title": "Data Type",
         "type": "string"
      },
      "air_1": {
         "anyOf": [
            {},
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "sflux air source 1",
         "title": "Air 1"
      },
      "air_2": {
         "anyOf": [
            {},
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "sflux air source 2",
         "title": "Air 2"
      },
      "rad_1": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataBlob"
            },
            {
               "$ref": "#/$defs/SfluxRad"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "sflux rad source 1",
         "title": "Rad 1"
      },
      "rad_2": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataBlob"
            },
            {
               "$ref": "#/$defs/SfluxRad"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "sflux rad source 2",
         "title": "Rad 2"
      },
      "prc_1": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataBlob"
            },
            {
               "$ref": "#/$defs/SfluxPrc"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "sflux prc source 1",
         "title": "Prc 1"
      },
      "prc_2": {
         "anyOf": [
            {
               "$ref": "#/$defs/DataBlob"
            },
            {
               "$ref": "#/$defs/SfluxPrc"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "sflux prc source 2",
         "title": "Prc 2"
      }
   },
   "$defs": {
      "DataBlob": {
         "additionalProperties": false,
         "description": "Data source for model ingestion.\n\nGeneric data source for files that either need to be copied to the model directory\nor linked if `link` is set to True.",
         "properties": {
            "model_type": {
               "default": "data_blob",
               "description": "Model type discriminator",
               "enum": [
                  "data_blob",
                  "data_link"
               ],
               "title": "Model Type",
               "type": "string"
            },
            "id": {
               "default": "data",
               "description": "Unique identifier for this data source",
               "title": "Id",
               "type": "string"
            },
            "source": {
               "description": "URI of the data source, either a local file path or a remote uri",
               "title": "Source"
            },
            "link": {
               "default": false,
               "description": "Whether to create a symbolic link instead of copying the file",
               "title": "Link",
               "type": "boolean"
            }
         },
         "required": [
            "source"
         ],
         "title": "DataBlob",
         "type": "object"
      },
      "DatasetCoords": {
         "additionalProperties": false,
         "description": "Coordinates representation.",
         "properties": {
            "t": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "time",
               "description": "Name of the time coordinate",
               "title": "T"
            },
            "x": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "longitude",
               "description": "Name of the x coordinate",
               "title": "X"
            },
            "y": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "latitude",
               "description": "Name of the y coordinate",
               "title": "Y"
            },
            "z": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Name of the z coordinate",
               "title": "Z"
            },
            "s": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Name of the site coordinate",
               "title": "S"
            }
         },
         "title": "DatasetCoords",
         "type": "object"
      },
      "Filter": {
         "additionalProperties": false,
         "properties": {
            "sort": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Sort"
            },
            "subset": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Subset"
            },
            "crop": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Crop"
            },
            "timenorm": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Timenorm"
            },
            "rename": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Rename"
            },
            "derived": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Derived"
            }
         },
         "title": "Filter",
         "type": "object"
      },
      "SfluxPrc": {
         "description": "This is a single variable source for and sflux input",
         "properties": {
            "model_type": {
               "const": "grid",
               "default": "grid",
               "description": "Model type discriminator",
               "title": "Model Type",
               "type": "string"
            },
            "id": {
               "default": "sflux_source",
               "description": "id of the source",
               "title": "Id",
               "type": "string"
            },
            "source": {
               "default": null,
               "title": "Source"
            },
            "link": {
               "default": false,
               "description": "Whether to create a symbolic link instead of copying the file",
               "title": "Link",
               "type": "boolean"
            },
            "filter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Filter"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Optional filter specification to apply to the dataset"
            },
            "variables": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": [],
               "description": "Subset of variables to extract from the dataset",
               "title": "Variables"
            },
            "coords": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DatasetCoords"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {
                  "t": "time",
                  "x": "longitude",
                  "y": "latitude",
                  "z": null,
                  "s": null
               },
               "description": "Names of the coordinates in the dataset"
            },
            "crop_data": {
               "default": true,
               "description": "Update crop filters from Grid and Time objects if passed to get method",
               "title": "Crop Data",
               "type": "boolean"
            },
            "buffer": {
               "default": 0.0,
               "description": "Space to buffer the grid bounding box if `filter_grid` is True",
               "title": "Buffer",
               "type": "number"
            },
            "time_buffer": {
               "default": [
                  0,
                  1
               ],
               "description": "Number of source data timesteps to buffer the time range if `filter_time` is True",
               "items": {
                  "type": "integer"
               },
               "title": "Time Buffer",
               "type": "array"
            },
            "data_type": {
               "const": "sflux_prc",
               "default": "sflux_rad",
               "description": "Model type discriminator",
               "title": "Data Type",
               "type": "string"
            },
            "relative_weight": {
               "default": 1.0,
               "description": "relative weight of the source file if two files are provided",
               "title": "Relative Weight",
               "type": "number"
            },
            "max_window_hours": {
               "default": 120.0,
               "description": "maximum number of hours (offset from start time in each file) in each file of set 1",
               "title": "Max Window Hours",
               "type": "number"
            },
            "fail_if_missing": {
               "default": true,
               "description": "Fail if the source file is missing",
               "title": "Fail If Missing",
               "type": "boolean"
            },
            "prate_name": {
               "default": null,
               "description": "name of precipitation rate variable in source",
               "title": "Prate Name",
               "type": "string"
            }
         },
         "title": "SfluxPrc",
         "type": "object"
      },
      "SfluxRad": {
         "description": "This is a single variable source for and sflux input",
         "properties": {
            "model_type": {
               "const": "grid",
               "default": "grid",
               "description": "Model type discriminator",
               "title": "Model Type",
               "type": "string"
            },
            "id": {
               "default": "sflux_source",
               "description": "id of the source",
               "title": "Id",
               "type": "string"
            },
            "source": {
               "default": null,
               "title": "Source"
            },
            "link": {
               "default": false,
               "description": "Whether to create a symbolic link instead of copying the file",
               "title": "Link",
               "type": "boolean"
            },
            "filter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Filter"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Optional filter specification to apply to the dataset"
            },
            "variables": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": [],
               "description": "Subset of variables to extract from the dataset",
               "title": "Variables"
            },
            "coords": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/DatasetCoords"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {
                  "t": "time",
                  "x": "longitude",
                  "y": "latitude",
                  "z": null,
                  "s": null
               },
               "description": "Names of the coordinates in the dataset"
            },
            "crop_data": {
               "default": true,
               "description": "Update crop filters from Grid and Time objects if passed to get method",
               "title": "Crop Data",
               "type": "boolean"
            },
            "buffer": {
               "default": 0.0,
               "description": "Space to buffer the grid bounding box if `filter_grid` is True",
               "title": "Buffer",
               "type": "number"
            },
            "time_buffer": {
               "default": [
                  0,
                  1
               ],
               "description": "Number of source data timesteps to buffer the time range if `filter_time` is True",
               "items": {
                  "type": "integer"
               },
               "title": "Time Buffer",
               "type": "array"
            },
            "data_type": {
               "const": "sflux_rad",
               "default": "sflux_rad",
               "description": "Model type discriminator",
               "title": "Data Type",
               "type": "string"
            },
            "relative_weight": {
               "default": 1.0,
               "description": "relative weight of the source file if two files are provided",
               "title": "Relative Weight",
               "type": "number"
            },
            "max_window_hours": {
               "default": 120.0,
               "description": "maximum number of hours (offset from start time in each file) in each file of set 1",
               "title": "Max Window Hours",
               "type": "number"
            },
            "fail_if_missing": {
               "default": true,
               "description": "Fail if the source file is missing",
               "title": "Fail If Missing",
               "type": "boolean"
            },
            "dlwrf_name": {
               "default": null,
               "description": "name of downward long wave radiation variable in source",
               "title": "Dlwrf Name",
               "type": "string"
            },
            "dswrf_name": {
               "default": null,
               "description": "name of downward short wave radiation variable in source",
               "title": "Dswrf Name",
               "type": "string"
            }
         },
         "title": "SfluxRad",
         "type": "object"
      }
   }
}

Fields:
Validators:
field air_1: Any | None = None#

sflux air source 1

Validated by:
field air_2: Any | None = None#

sflux air source 2

Validated by:
field data_type: Literal['sflux'] = 'sflux'#

Model type discriminator

Validated by:
field prc_1: DataBlob | SfluxPrc | None = None#

sflux prc source 1

Validated by:
field prc_2: DataBlob | SfluxPrc | None = None#

sflux prc source 2

Validated by:
field rad_1: DataBlob | SfluxRad | None = None#

sflux rad source 1

Validated by:
field rad_2: DataBlob | SfluxRad | None = None#

sflux rad source 2

Validated by:
validator check_weights  »  all fields[source]#

Check that relative weights for each pair add to 1.

Parameters:
  • cls – The class.

  • v – The variable.

Raises:

ValueError – If the relative weights for any variable do not add up to 1.0.

get(destdir: str | Path, grid: SCHISMGrid | None = None, time: TimeRange | None = None) Path[source]#

Writes SCHISM sflux data from a dataset.

Parameters:
  • destdir (str | Path) – The destination directory to write the sflux data.

  • grid (Optional[SCHISMGrid], optional) – The grid type. Defaults to None.

  • time (Optional[TimeRange], optional) – The time range. Defaults to None.

Returns:

The path to the written sflux data.

Return type:

Path

validator validate_air_fields  »  all fields[source]#

Validate air fields after model creation.