pyreshaper.specification module¶
The module containing the PyReshaper configuration specification class
This is a configuration specification class, through which the input to the PyReshaper code is specified. Currently all types of supported operations for the PyReshaper are specified with derived dypes of the Specification class.
Copyright 2020 University Corporation for Atmospheric Research
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
pyreshaper.specification.
Specifier
(infiles=[], ncfmt='netcdf4', compression=0, least_significant_digit=None, prefix='tseries.', suffix='.nc', timeseries=None, metadata=[], meta1d=False, backend='netCDF4', exclude_list=[], metafile=None, **kwargs)¶ Bases:
object
Time-slice to Time-series Convertion Specifier
This class acts as a container for the various input data needed by the Reshaper to perform the time-slice to time-series operation.
-
validate
()¶ Perform self-validation of internal data
-
validate_types
()¶ Method for checking the types of the Specifier data.
This method is called by the validate() method.
-
validate_values
()¶ Method to validate the values of the Specifier data.
This method is called by the validate() method.
We impose the (somewhat arbitrary) rule that the Specifier should not validate values what require “cracking” open the input files themselves. Hence, we validate values that can be checked without any NetCDF file I/O (including reading the header information).
This method will correct some input if it is safe to do so.
-
write
(fname)¶ Write the specifier to a file
- Parameters:
fname (str): Name of file to write
-
-
pyreshaper.specification.
create_specifier
(**kwargs)¶ Factory function for Specifier class objects. Defined for convenience.
- Parameters:
kwargs (dict): Optional arguments to be passed to the newly created Specifier object’s constructor.
- Returns:
Specifier: An instantiation of the type of Specifier class desired.