Using Header or .hdr files for GIS data in .flt format
Overview
Some researchers encounter issues with either accessing or distributing spatial data in .flt (float) files because different software packages can expect the associated .hdr (header) to be in a different format. For this reason, some of the data collections in the Data Access Portal do not include .hdr files. An example would be Australian monthly fPAR derived from Advanced Very High Resolution Radiometer reflectances – version 5. Instead, the information required for creating a header file is included in the readme file (AVHRR_VegData_readme_v5.txt).
Below are some examples of how to use this information to create and use header files that work in some free GIS software packages.
8km resolution header files
Using the example mentioned in the overview above, let’s say we have downloaded the data and want to open the file “v5/Persistent_fPAR/8km/Aust_fper_8km_mth006_198107_v5.flt“.
Create a text file in the same working folder that the data file is in and label it “Aust_fper_8km_mth006_198107_v5.hdr“
In the contents of the .hdr file, paste in the following:
NODATA_VALUE -999 BYTEORDER LSBFIRST XLLCORNER 109.96 YLLCORNER -45.08 NROWS 439 NCOLS 564 CELLSIZE 0.08
These values have been obtained from the readme file (AVHRR_VegData_readme_v5.txt).
Opening the data in DIVA-GIS
You can now open this in DIVA-GIS (http://www.diva-gis.org/) by:
- using the Data -> Import to Gridfile -> Single File menu option.
- Choose “ESRI binary (FLOAT)” as the file type, and then select the .flt file as the “input file. The output file option is automatically populated.
- Now click OK
Opening the data in QGIS
You can open the file in QGIS (http://www.qgis.org) by:
- Selecting the Layer -> Add Layer -> Add Raster Layer menu option.
- Select the .flt file and click “open”. It will ask for a Coordinate Reference System. Note that the readme file provided with the data says to use “WGS84”
Opening the data in ArcGIS
There are several methods, but if you don’t have any storage mapped in ArcCatalog, here is one (tested in ArcGIS 10.3).
- Right-click the layers icon and select “Add Data”
- Click the “Connect to Folder” icon.
- Navigate to the folder where you are storing the data files
- Select the .flt file you are interested in:
- Note: if you receive an error about the data being an invalid raster dataset, you may need to check that you have created the .hdr file correctly.
- You may receive a warning, “Unknown Spatial Reference”. If so, you can correct this later.
- If the data has loaded correctly, it should appear as below:
- If you need to correct the coordinate reference system, in ArcToolbox go to “Data Management Tools” → “Projections and Transformations” → “Define Projection”.
- Specify the input layer, then click the “Select System” button
- Navigate to “WGS 1984” and click “OK”
Other software
ENVI
It’s possible that ENVI uses a different syntax for header files. For users of ENVI, there are some example header files in http://dx.doi.org/10.4225/08/514B7FD66D557 that appear to use this syntax, so it’s possible they could be copied and modified according to the detail in the readme file ( AVHRR_VegData_readme_v5.txt).
1km resolution files
The required steps are the same as for the 8km resolution files, but the content of the header file should be as below:
NODATA_VALUE -999 BYTEORDER LSBFIRST XLLCORNER 109.995 YLLCORNER -45.008 NROWS 3501 NCOLS 4501 CELLSIZE 0.01
Creating all required header files as a batch
Since the contents of the header files for any given resolution will be the same, you just need to copy the one file over and over using the correct file name for each one.
Windows command line
You could create a header file (e.g. 8km_header.hdr) and then run the following command from the folder the data is in (this assumes the template header file and the data files are all in one folder).
FOR %F in (*.flt) DO copy 8km_header.hdr %~nF.hdr
Unix command line (bash/zsh)
for i in *.flt; do cp 8km_header.hdr "${i%.*}.hdr"; done