Difference between revisions of "Custom Coverage Processor for Cubes"
Line 43: | Line 43: | ||
By writing a custom processor, anything can be used as a data source. | By writing a custom processor, anything can be used as a data source. | ||
− | [[Category:Cube]] | + | [[Category:Cube]][[Category:Server]] |
Revision as of 13:01, 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
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.