Custom Coverage Processor for Cubes

From Earth Science Information Partners (ESIP)

< Back to Glossary | Edit with Form

Custom_Coverage_Processor_for_Cubes Description: [[TermDesc::This processor extracts a subset of cube data from a non-standard data source. Cube data that is not in a single netCDF-CF file requires this kind of a custom processor that can read a subset and write it into a netCDF-CF file. Used in WCS GetCoverage Query.]]

Glossary Domain: WCS

Related Links

Links to this page
[[Links::NetCDF-CF WCS GetCoverage Query Data Configuration for Cubes]]


No Contributors


No History Available

Term Details

HTAP custom processor

The HTAP demo service stores data in daily netCDF-CF files. The custom module must:

  • Check, that only one datetime in the TimeSequence is used, because getting timeseries from separate files is not supported.
  • Locate the correct file. Normally, the file is just the coverage identifier and '.nc' extension. In this case the template is GEMAQ-v1p0_SR1_sfc_%(year)s_%(doy) year and doy, Julian day, gets replaced.

The implements this by inheriting the default netCDF-CF processor and overriding the _input_file method.

   def _input_file(self, query):

Check that the query has exactly one datetime.

       if len(query.time) != 1:
           raise owsutil.OwsError(
               'time parameter must match exactly one datetime')

Get the single datetime

       datetimes = query.time.all_datetimes()
       dt = datetimes[0]

Now get the file template from the configuration

       config = self._load_config(query)[query.identifier]
       files = metadata['files']
       ncfile = files['template'] % {'year':str(dt.year), 'doy': str(iso_time.day_of_year(dt)).zfill(3)}

Now we have the filename, get the folder and return the full file path name.

       src_root, last = __file__, 
       while last != 'web':
           src_root, last = os.path.split(src_root)
       return os.path.join(src_root, files['path'], ncfile)

By writing a custom processor, anything can be used as a data source.