Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Fews allows you to write your own time series import format with javain Java.

In the import module you one can specify the fully qualified class name and the bin directory that contains a jar file with you compiled java code and optimally other third party libaries. A jar file is just a zip file that contains you compiled java files.
e.g. classname = com.yourcompany.yourparsers.YourParser
and binDir = $REGION_HOME$/parsers/bin

...

Time Series Content handler

The interface is described in: TimeSeriesContentHandler.java

...

With a virtual dir the parser can open meta files with additional information required for to parse file that retain in the same directory as the imported file. For example some grid coverage formats need an additional file for the geo referencing.

PropertiesConsumer

SINCE FEWS 2011.01
Ideally a parser does not need any additional information and is dedicated to parse one strict specified file format.
In some cases the parser needs additional configuration. Don't use a separate additional configuration file in this case because this file can not be managed by FEWS.
You can configure additional properties in the time series import module. By implementing the PropertiesConsumer interface the properties are injected in your parser.

Code Block
xml
xml
<import>
    <general>
      <importType>PI</importType>
      <folder>$IMPORT_FOLDER$/meteo/tabel/tk</folder>
      <failedFolder>$IMPORT_FAILED_FOLDER$/meteo/tabel/tk</failedFolder>
      <backupFolder>$IMPORT_BACKUP_FOLDER$/meteo/tabel/tk</backupFolder>
      <idMapId>IdImportMeteo_1d</idMapId>
      <unitConversionsId>ImportUnitConversions</unitConversionsId>
      <dataFeedId>Neerslag_24uur</dataFeedId>
    </general>
    <properties>
      <string key="decimalSeparator" value="."/>
    /properties>
    <timeSeriesSet>


Code Block
public class CsvTimeSeriesParser implements TextParser<TimeSeriesContentHandler>, PropertiesConsumer {
    @Override
    public void setProperties(Properties properties) {
        decimalSeparator = properties.getString("decimalSeparator", ".");
    }


Examples

TextParsers

LocationIdsHeaderCsvParser.java

HcsTimeSeriesParser.java

WQCSVTimeSeriesParser.java

...

WiskiTimeSeriesParser.java

XML parsers

PiTimeSeriesParser.java
PiTimeSeriesSerializerPiMapStackParser.java

Binary parsers

GrayscaleImageTimeSeriesParser.java (with header is separate file)

MosaicRadarTimeSeriesParser.java (Little endian IEEE floats and integers)

NimrodGridTimeSeriesParser.java

Server parsers

RmoTimeSeriesServerParser.java

Example project with source code

FEWS_Example_Custom_Import_Export.119649.zip