Difference between revisions of "Custom Coverage Processor for Cubes"

From Earth Science Information Partners (ESIP)
Line 1: Line 1:
 
{{WCS Glossary
 
{{WCS Glossary
|TermDesc=Some cube data is not necessarily in a single NetCDF-CF file. A custom processor extracts a data subset in a GetCoverage Query from such a data source and writes the subset into a NetCDF-CF file.
+
|TermDesc=Some cube data is not necessarily in a single NetCDF-CF file. A custom processor extracts a data subset in a GetCoverage Query from such a data source and writes the subset into a NetCDF-CF file. Used in WCS GetCoverage Query.
 
|Links=[[NetCDF-CF|NetCDF-CF]] [[WCS_GetCoverage_Query|WCS GetCoverage Query]] [[Data_Configuration_for_Cubes|Data Configuration for Cubes]] [[Coverage_Processor_for_Cubes|Coverage Processor for Cubes]]
 
|Links=[[NetCDF-CF|NetCDF-CF]] [[WCS_GetCoverage_Query|WCS GetCoverage Query]] [[Data_Configuration_for_Cubes|Data Configuration for Cubes]] [[Coverage_Processor_for_Cubes|Coverage Processor for Cubes]]
 
}}
 
}}

Revision as of 11:37, September 3, 2010

< Back to Glossary | Edit with Form

Custom_Coverage_Processor_for_Cubes Description: Some cube data is not necessarily in a single NetCDF-CF file. A custom processor extracts a data subset in a GetCoverage Query from such a data source and writes the subset into a NetCDF-CF file. Used in WCS GetCoverage Query.

Glossary Domain: {{{Glossary Domain}}}"{{{Glossary Domain}}}" is not in the list (WCS, HTAP, AQInfrastructure) of allowed values for the "Glossary Domain" property.

Related Links

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

Contributors

No Contributors

History

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)s.nc year and doy, Julian day, gets replaced.

The HTAP_wcs.py 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(
               'CustomError',
               '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.