...PREPARING FOR THE CLIMATE AND HYDROLOGY MODULES


  1. Download each of the files below (right click and choose Save Link As...). Place them all in the same directory. This directory should be called DataPrep (or whatever you prefer). Make sure you have all 9 files. The Makefile is posted as a zipped file in order to prevent extra characters from being added during file transfer. This file should be unzipped using WinZip and placed in the DataPrep directory. You also need to copy into the DataPrep folder the libgd.a file from the GD directory within SLEUTH. Make sure that the GD directory has been successfully compiled on your system before transferring the file! Once the Makefile is unzipped and the compiled libgd.a file has been copied to the DataPrep folder, compile calcPercentages.c by typing "make". To get the program to compile on your system you may need to edit the Makefile. The executable will be called calcPercent.


    If you wish to download an unzipped version of the Makefile and edit out the ^M characters at the end of each line yourself, click here

  2. Copy the SLEUTH predicted land use files into this same directory. These files should have names such as "studysite_land_n_urban.2000.gif" (where "studysite" is the header for your particular run). Due to the data processing that is required for implementing the climate and hydrology modules, it is recommended that you not use the gif image from every year but rather every 5th year, for example.
  3. Also copy the land use map that initialized the SLEUTH run into this DataPrep directory. This should be in the SLEUTH model's input directory and have a name such as "studysite.landuse.1996.gif."
  4. Your landuse maps must have been based on the following classification scheme: 1=urban, 2=agriculture (bare soil and short vegetation), 3=forest and 4=water. They should be at a higher spatial resolution than 1-km. This module is established assuming input at a 25-meter resolution. If this is not the case, you will need to edit the kernel size in calcPercentages.c.

  5. Run each of these gif images through the calcPercent program. The usage is

    calcPercent <land use GIF file> <stub landuse> <stub urban> <stub ag> <stub forest> <stub water>

    where < > are user defined fields.

    For example...

    calcPercent studysite.landuse.1996.gif land96 urb96 ag96 for96 wat96

    ***Be sure to include the year in your output filenames!

  6. calcPercent reads in the gif land use map produced from SLEUTH and outputs ascii and gif files using the "stubs" you provide. These files are explained below. ("xx" represents the year)

    landxx.asc
    This is merely an ascii echo of the input land use map. It is at the same resolution as the original land use map (preferably 25 meter).
    urbxx.asc and urbxx.gif
    These are based on 1-km aggregates of the land classes within the original land use map. Each 1-km2 parcel of land has a certain percentage of its area classified as urban. urbxx.asc is an ascii file containing this percentage (integer) at a 1-km resolution, while urbxx.gif is a gif image with the same information. The gif image can be used for quick verification purposes to make sure the data is correct.
    agxx.asc and agxx.gif
    These files are the same as above, only the numbers in each cell reflect the percentage of the 1-km2 land parcel that is classified as agricultural.
    forxx.asc and forxx.gif
    ...the numbers in each cell reflect the percentage of the 1-km2 land parcel that is classified as forest.
    watxx.asc and watxx.gif
    ...the numbers in each cell reflect the percentage of the 1-km2 land parcel that is classified as water.


  7. Move the urbxx, agxx, forxx and watxx files to the folder containing the Climate module. These 1-km data files will only be used for the climate related work.
  8. Move the landxx files to the folder containing the Hydrology modules (runoff to rainfall ratio and SCS). These modules require the land use information at the original resolution.



...ANY ADDITIONAL PREP AND VISUALIZING THE MODULE'S OUTPUT


  1. The following algorithm can be used in general to convert any gif image into an ascii file or, conversely, any ascii file into a gif image. If you are going to use your own hydrologic soil group layers for the SCS direct runoff module, you can use this program to convert the gif layers to the ascii format that is required by the module. (Likewise if you choose to use the buffer option in the runoff to rainfall ratio module for the southeastern Pennsylvania basins.) The program can also be used to turn each of the module's ascii outputs back into gif images for visualization purposes. Just copy any file of interest into the directory that you will be guided in establishing below. For ascii files, be sure you know the number of rows and columns that the resulting gif should have.

  2. Download each of the files below (right click and choose Save Link As...). Place them all in the same directory. This directory should be called Convert (or whatever you prefer). Make sure you have all 10 files. The Makefile is posted as a zipped file in order to prevent extra characters from being added during file transfer. This file should be unzipped using WinZip and placed in the Convert directory. You also need to copy into the Convert folder the libgd.a file from the GD directory within SLEUTH. Make sure that the GD directory has been successfully compiled on your system before transferring the file! Once the Makefile is unzipped and the compiled libgd.a file has been copied to the Convert folder, compile giftoint.c by typing "make". To get the program to compile on your system you may need to edit the Makefile. The executable will be called giftoint. Note that the gd*.h and libgd.a files are the same as for calcPercent; you may just want to copy the files over from your previously established folder.


    If you wish to download an unzipped version of the Makefile and edit out the ^M characters at the end of each line yourself, click here

  3. To run a gif image (such as your soils or buffer layer) through the giftoint program, the usage is just

    giftoint <GIF file>

    that is...

    giftoint soilsgroupA.gif

    This will echo the image as ascii output with the name soilsgroupA.gif.asc.

  4. To run an ascii file (such as a module's output) through the giftoint program, the usage is

    giftoint <ASCII file> <number of rows> <number of columns>

    that is...

    giftoint init_tstar_forgif.asc 26 23

    This will create an image called init_tstar_forgif.asc.gif with 26 rows and 23 columns.




**To run the climate and hydrology modules and move files back and forth between them and the SLEUTH model, a good bit of organization is required. It is up to you how to do this. Suggestions are to create different directories for each module and data prep program, move the relevant files into these directories, and then organize the output that is generated in logically named folders. Delete any extra files that may not be needed after their initial use (such as the 1-km agxx.gif, forxx.,gif and watxx.gif files that are generated as part of calcPercent for all the years of predicted land use - don't delete the ones for the initial year).**