Introduction

Export a grid timeseries to multiple ESRI ASCII grid format files in PI Mapstack format

The ASCII Grid format is a plain text format that was first implemented in Arc/Info and is documented by ESRI.

The MapStack format is a FEWS specific way to export a grid timeseries in one or more files using either ESRI ASCII grid, PC-Raster or USGS BIL format files. As the ASCII grid file format can only contain a single grid dataset, for this format multiple files are stored, one per timestep and / or parameter. The MapStack format was implemented primarily for the purpose of transferring gridded dats to and from external models using the General Adapter, but it is also supported by both the Import and Export module. A map stack is always represented by a main XML file which contains the relevant meta data of the exported set of grid files.

By default, the mapstack serializer will use a file naming scheme for ASCII grid exports where the file names are numbered for each separate timestep, alternatively a "FileNameDateTimeStamp can be set as property in the export configuration for clarity, so it is immediately clear from the file name of eaxt exported grid which date and time it represents.

The ID of this serializer is 'pi_ascii_map_stack'

Example module configuration

<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesExportRun 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/timeSeriesExportRun.xsd">
	<export>
		<general>
			<exportType>pi_ascii_map_stack</exportType>
			<folder>$EXPORT_FOLDER$</folder>
			<exportFileName>
				<name>mapstack_grid.xml</name>
			</exportFileName>
			<idMapId>MapStack</idMapId>
		</general>
		<properties>
			<string key="fileNameDateTimePattern" value="yyyyMMdd_HHmm"></string>
		</properties>
		<timeSeriesSet>
			<moduleInstanceId>ExportMapStackAscii</moduleInstanceId>
			<valueType>grid</valueType>
			<parameterId>H.m</parameterId>
			<locationId>H-2001</locationId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="hour"/>
			<relativeViewPeriod unit="hour" start="-2" end="0"/>
			<readWriteMode>read only</readWriteMode>
		</timeSeriesSet>
	</export>
</timeSeriesExportRun>

Notes:

1) The 'exportFileName' setting provides the name of the main mapstack xml file (see the example below) which contains the meta data of the collection of files making up a mapstack. The name of the ASCII grid files that are exported are composed of the location and in case of multiple paramters the parameter name, seperated by underscores an follow by either a suffix indicating the timestep number or a date/time stamp if configured.

2) The file numbering scheme used by default by the mapstack serializer can be overridden by a property "fileNameDateTimePattern" to define a date & time format patters to use for the file name suffix.

3) The exportMissingValue can be used to replace the missing values by given number to indicate that there is no valid data, this option is required to use the resulting files with ArcGIS as the default setting using 'NaN' to represent missing values is not supported by ArcGIS.

An example of the structure of the MapStack XML file is given below, this example uses the ESRI ASCII grid format to store the actual data where the filename contains a date/time stamp:

Example:

<?xml version="1.0" encoding="UTF-8"?>
<MapStacks xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews/PI" xsi:schemaLocation="http://www.wldelft.nl/fews/PI http://fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_mapstacks.xsd" version="1.2">
    <geoDatum>WGS 1984</geoDatum>
    <timeZone>0.0</timeZone>
    <mapStack>
        <locationId>EA_H-2001</locationId>
        <parameterId>waterlevel</parameterId>
        <timeStep unit="hour" multiplier="1"/>
        <startDate date="2003-02-28" time="22:00:00"/>
        <endDate date="2003-03-01" time="00:00:00"/>
        <file>
            <ascii file="_EA_H-2001_'yyyyMMdd_HHmm'.asc"/>
        </file>
    </mapStack>
</MapStacks>

 

  • No labels