1

I am trying to convert ASTER level 2 HDF files (AST_08 Surface Kinetic Temperature) to GeoTiff using the HEG swtif tool and a parameter file from the command line in Ubuntu. When I run the program I get the following error:


(swtif)
Start Time: Sat May 13 01:15:56 2017


Listing Command Line Options:
./swtif -p param_file

Error: Failed to get environment variable PWD. Not setting it may cause >some problems later.
Error: Check_envs_for_space : Environmental Variable Not Found
: One of the environment vaiables PWD, MRTDATADIR, PGSHOME, or >MRTBINDIR has not been set or has an illegal space in it. This causes >problem later.
Fatal Error, Terminating...
Fatal Error, Terminating...

The contents of the parameter file are:

NUM_RUNS = 1

BEGIN
INPUT_FILENAME = /home/me/Documents/data/AST_08_00301012002193924_20170512065710_28288.hdf
OBJECT_NAME = SurfaceKineticTemperature
FIELD_NAME = KineticTemperature|
BAND_NUMBER = 1
OUTPUT_PIXEL_SIZE_X = 90.0
OUTPUT_PIXEL_SIZE_Y = 90.0
SPATIAL_SUBSET_UL_CORNER = ( 14.635767 39.845845 )
SPATIAL_SUBSET_LR_CORNER = ( 13.970527 40.618836 )
RESAMPLING_TYPE = NN
OUTPUT_PROJECTION_TYPE = UTM
ELLIPSOID_CODE = WGS84
UTM_ZONE = 0
OUTPUT_PROJECTION_PARAMETERS = ( 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0  )
OUTPUT_FILENAME = /home/me/Documents/data/processed/AST_08_00301012002193924_20170512065710_28288_SurfaceKineticTemperature.tif
OUTPUT_TYPE = GEO
END

Which I run at the command line with:

export MRTDATADIR=/opt/heg/data
export PGSHOME=/opt/heg/TOOLKIT_MTD
sudo ./swtif -p param_file

I've tried setting the environment variable PWD manually, but I get the same error.

3 Answers 3

1

Running HEG from the command line can be temperamental where environment variables are not set correctly (as seems to be the case for you). You need to set the environment variable mentioned in the error message (PWD). However, HEG has a gui which is less pernickety, so that may be a better route if you are struggling with the environment variables.

An alternative would be to use GDAL instead which is free and open source. Then again, many GIS packages will simply read HDF anyway (ArcGIS, QGIS etc) so you could just use the HDFs without converting them or mosaic them into a VRT if you have a lot of files.

1

The error:

Error: Failed to get environment variable PWD

occurs because the environment variable PWD is not present in the superuser account. Adding the argument -E to sudo like this:

sudo -E ./swtif -p param_file

propagates your environment variables to the super user account and fixes the problem.

0

You should use cmd with the HEG running.

1
  • Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Please check out our short tour to learn about our focussed Q&A format.
    – PolyGeo
    Commented May 12, 2021 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.