act.utils.DatastreamParserARM#

class act.utils.DatastreamParserARM(ds='')[source]#

Class to parse ARM datastream names or filenames into its components. Will return None for each attribute if not extracted from the filename.

Variables:
  • site (str or None) – The site code extracted from the filename.

  • datastream_class (str) – The datastream class extracted from the filename.

  • facility (str or None) – The datastream facility code extracted from the filename.

  • level (str or None) – The datastream level code extracted from the filename.

  • datastream (str or None) – The datastram extracted from the filename.

  • date (str or None) – The date extracted from the filename.

  • time (str or None) – The time extracted from the filename.

  • ext (str or None) – The file extension extracted from the filename.

Example

>>> from act.utils.data_utils import DatastreamParserARM
>>> file = 'sgpmetE13.b1.20190501.024254.nc'
>>> fn_obj = DatastreamParserARM(file)
>>> fn_obj.site
'sgp'
>>> fn_obj.datastream_class
'met'

Constructor that initializes datastream data member and runs parse_datastream class method. Also converts datastream name to lower case before parsing.

dsstr

The datastream or filename to parse

set_datastream(ds)

Method used to set or reset object by passing a new datastream name.

datastream

Property returning current datastream name stored in object in standard lower case.

datastream_class

Property returning current datastream class name stored in object in standard lower case.

datastream_standard

Property returning datastream name in ARM-standard format with facility in caps.

date

Property returning date from filename.

ext

Property returning file extension from filename.

facility

Property returning current facility name stored in object in standard upper case.

level

Property returning current data level stored in object in standard lower case.

site

Property returning current site name stored in object in standard lower case.

time

Property returning time from filename.