Overview

The CEMIG import function (<importType>CEMIG</importType>) imports grid time series from a CEMIG specific binary format (4 bytes for a float value). The CEMIG binary format contains only values. The filename contains the observation or forecast date.

The following CEMIG data files have been tested for the importer: ANNA25, CPTEC15, ETA_CEMIG and TRMM.

The importer has to be configured with some properties. Possible configuration properties are:

  • forecast (optional): Possible values are true or false. Default is false. If forecast is set to true, the forecast issue date will be registered as T0 and the first import value will be assumed to start at T0 + the configured timeStep.

  • vars (required): should contain one or more parameters separated by a  comma (,) . The parameters are expected to be present in the binary file in the specified order. If more than one variable is specified, only one time step is assumed. Specifying a tdefUnit and tdefValue is considered an error in this case. Always specify all parameters that are available in the input file.

  • fileNameDateTimePattern (required): pattern of the filename where the date is marked with single quotes ('). For example "prec_'yyyyMMdd'.bin". The date is used to determine T0 or the forecast issue date from the file name.

  • tdefUnit (optional): Required if more than one timestep is available in the binary format. Possible values are: second, minute, hour, day, month, year. Only equidistant timesteps are supported.

  • tdefValue (optional): Specifify the amount of units specified in the tdefUnit.

  • bytesToSkipBetweenTimeSteps (optional): The number of bytes between each time step that should be skipped. Default is 0. (For the cptec15 format the value should be set to 8).

The import files can be gzipped. They should have the .gz extension. In the fileNameDateTimePattern the .gz extension doesn't have to be specified.

Configuring the Import

To make the importer known to FEWS, the import module has to be declared in the moduleInstanceDescriptors.xml in the RegionConfigFiles directory of the FEWS configuration:

<?xml version="1.0" encoding="UTF-8"?>
<moduleInstanceDescriptors xmlns="http://www.wldelft.nl/fews"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xsi:schemaLocation="http://www.wldelft.nl/fews
		http://fews.wldelft.nl/schemas/version1.0/moduleInstanceDescriptors.xsd" version="1.0">
...
	<moduleInstanceDescriptor id="ImportCEMIG-anna25">
		<moduleId>TimeSeriesImportRun</moduleId>
	</moduleInstanceDescriptor>
...
</moduleInstanceDescriptors>

An example of the CEMIG import (filename: ImportCEMIG-anna25.xml) configuration for the anna25 files will be given here. The importType is named CEMIG which should be configured in the general section of the import.

An optional gridStartPoint can be specified. Currently only NW and SW are supported. Default is NW.

<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesImportRun xmlns="http://www.wldelft.nl/fews" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://www.wldelft.nl/fews 
	http://fews.wldelft.nl/schemas/version1.0/timeSeriesImportRun.xsd">
	<import>
		<general>
			<importType>CEMIG</importType>
			<folder>$IMPORT_CEMIG_FOLDER$/anna</folder>
			<idMapId>cemigMapId</idMapId>
			<missingValue>-999</missingValue>
			<gridStartPoint>SW</gridStartPoint>
		</general>
		<properties>
			<bool key="forecast" value="false"/> <!-- default is false -->
			<string key="vars" value="prec"/> <!-- comma (,) separated list of variabeles. If more than one variable is specified, only one timestep is assumed. Specifying a tdefUnit and tdefValue is considered an error in this case. -->
			<string key="fileNameDateTimePattern" value="prec_'ddMMyyyy'.bin"/> <!-- define the date format to determine T0 or the forecast date  from the file name. -->
			<string key="tdefUnit" value="hour"/> <!-- define the timestep unit: second, minute, hour, day, month, year -->
			<string key="tdefValue" value="3"/> <!-- specifify the value related to the tdefUnit. -->
		</properties>
		<timeSeriesSet>
			<moduleInstanceId>ImportCEMIG-anna25</moduleInstanceId>
			<valueType>grid</valueType>
			<parameterId>H.observed</parameterId>
			<locationId>CMEG-anna25-location</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="hour" multiplier="3"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>
	</import>

</timeSeriesImportRun>

The IdMapping configuration cemigMapId.xml is needed to maps the internal FEWS Id's to the CEMIG Id's. An example IdMapping file importer is shown below.:

<?xml version="1.0" encoding="UTF-8"?>
<idMap version="1.1" xmlns="http://www.wldelft.nl/fews"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wldelft.nl/fews
http://fews.wldelft.nl/schemas/version1.0/idMap.xsd">
	....
	<parameter internal="H.observed" external="prec"/>
	....
</idMap>

The actual grid definition (grids.xml) looks as follows:

<?xml version="1.0" encoding="UTF-8"?>
<grids xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/grids.xsd">

	<regular locationId="CMEG-anna25-location">
		<description>CMEG ANA25 Import</description>
		<rows>160</rows>
		<columns>176</columns>
		<geoDatum>WGS 1984</geoDatum>
		<firstCellCenter>
			<x>-76.25</x>
			<y>5.50</y>
		</firstCellCenter>
		<xCellSize>0.25</xCellSize>
		<yCellSize>0.25</yCellSize>
	</regular>
</grids>
  • No labels