ASCII2DDR | |----ascii2ddr | |------c_inlas | |------get_par | | | |------p_find | | | |------c_getsys | | | |------c_getnam | | | |------access | | | |------p_find | | | |------c_cmhost | | | |------access | |------parse_ascddr | | | |------fopen | | | |------read_criticals | | | | | |------skip_line | | | | | | | |------fgets | | | | | | | |------feof | | | | | |------read_line | | | | | | | |------fgets | | | | | | | |------feof | | | | | |------sscanf | | | | | |------c_low2up | | | | | |------skip_line | | | |------read_noncriticals | | | | | |------get_proj_code | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | | | |------c_low2up | | | | | | | |------sscanf | | | | | |------get_zone_code | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | |------get_datum_code | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | | | |------c_low2up | | | | | | | |------sscanf | | | | | |------get_proj_parms | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_check_proj_params | | | | | |------get_corn_coords | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | |------get_proj_dist | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | |------get_proj_unit | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | | | |------c_low2up | | | | | |------get_inc | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | | | |------get_mast_coords | | | | | | | |------read_line | | | | | | | |------sscanf | | | | | | | |------c_low2up | | | |------read_bddrs | | | | | |------skip_line | | | | | |------read_line | | | | | |------sscanf | | | | | |------skip_line | | | | | |------read_line | | | | | |------sscanf | | | | | |------c_low2up | | | | | |------read_line | | | | | |------sscanf | | | | | |------c_low2up | | | | | |------skip_line | | | | | |------read_line | | | | | |------sscanf | | | | | |------sscanf | | | | | |------read_line | | | | | |------sscanf | | | | | |------sscanf | | | | | |------read_line | | | | | |------sscanf | | | | | |------sscanf | | | | | |------read_line | | | | | |------sscanf | | | | | |------sscanf | | | | | |------read_line | | | | | |------sscanf | | | | | |------sscanf | | | | | |------fgets | | | | | |------feof | | | |------fclose | |------c_install_cleanup_handler | |------c_putddr | |------c_putbdr | |------c_lused | |------c_remove_cleanup_handler | |------c_complt
1. ASCII2DDR | ------> | Main function |
Input Parameters: | INFILE count=1 (string) |
OUT count=1 (string) |
2. ascii2ddr | ------> | Contains the main function which calls the routine to parse the ASCII DDR file and writes the retrieved information to the binary DDR file. |
Return Type: | int, (EXIT_SUCCESS, EXIT_FAILURE) |
Call get_par - &vblock, in_hpath, out_hpath, system, &g_delflg
Call parse_ascddr - in_hpath, system, &ddr, bddrs
Call c_install_cleanup_handler - signal_cleanup
Call c_putddr - out_hpath, &ddr (if return is E_FAIL, call cleanup_files before exiting program)
For each band
Call c_remove_cleanup_handler
Write completion message using c_complt and exit
3. get_par | ------> | This function retrieves the parameters from TAE and verifies that they are correct. |
Input Parameters: | struct PARBLK *vblock - TAE parameter block |
Output Parameters: | char in_hpath[CMLEN] - Input ASCII DDR filename |
char out_hpath[CMLEN] - Output binary DDR filename | |
char system[12] - System data is on from global $DATASYS | |
int *delflg - Value of $DELFLG | |
Return Type: | int, (E_SUCC or E_FAIL) |
Retrieve the TAE global $DATASYS using c_getsys
Retrieve INFILE field using c_getnam
If INFILE could not be accessed, append ".prt" to the filename and try again
Retrieve OUT field using p_find
Create outfile host path using c_cmhost
Validate the nonexistence of OUT using access
4. parse_ascddr | ------> | This function reads the DDR field values, validating each as it is read in, and places the values into DDR and BDDR structures. |
Input Parameters: | char hpath[CMLEN] - Input ASCII DDR file to parse |
char system[12] - Computer system data is on | |
Output Parameters: | struct DDR *ddr - Output DDR structure |
struct BDDR *bddrs - Output BDDR structures | |
Return Type: | int (E_SUCC or E_FAIL) |
Call read_criticals - fp, ddr
Call read_noncriticals - fp, ddr
Call read_bddrs - fp, ddr->nbands, ddr->dtype, bddrs
Close the ASCII DDR file using fclose
5. read_criticals | ------> | This function reads the critical DDR field values, validating each as it is read in. These are the field values that will cause the application to exit with a fatal error if they are invalid. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Read line containing number lines, number samples, number bands, dtype using read_line
Parse values out of line using sscanf
Make dtype string all uppercase for comparisons using c_low2up
Validate values
Skip last mod date/time and system line using skip_line
6. skip_line | ------> | This function skips the next line in the ASCII DDR file. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Return Type: | int (E_SUCC or E_FAIL) |
If fgets failed determine if it was due to EOF or general failure using feof
7. read_line | ------> | This function reads the next line from the ASCII DDR file. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | char *line_buf - Line buffer |
Return Type: | int (E_SUCC or E_FAIL) |
If fgets failed determine if it was due to EOF or general failure using feof
8. read_noncriticals | ------> | This function calls the routines to read the non-critical DDR field values. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Call get_zone_code to retrieve the zone code
Call get_datum_code to retrieve the datum code
Call get_proj_parms to retrieve the projection parameters
Call get_corn_coords to retrieve the corner coordinates
Call get_proj_dist to retrieve the projection distance
Call get_proj_unit to retrieve the projection units
Call get_inc to retrieve the line and sample increments
Call get_mast_coords to retrieve the master coordinates
9. get_proj_code | ------> | This function retrieves the projection code and projection code validity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse values out of line using sscanf
Make strings all uppercase for comparisons using c_low2up
Parse projection number out of projection code string
Validate values
10. get_zone_code | ------> | This function retrieves the zone code and zone code validity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse values out of line using sscanf
Make validity string all uppercase for comparisons using c_low2up
Validate values
11. get_datum_code | ------> | This function retrieves the datum code and datum code validity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse values out of line using sscanf
Make strings all uppercase for comparisons using c_low2up
Parse datum number out of datum code string
Validate values
12. get_proj_parms | ------> | This function retrieves the projection parameters and projection parameters validity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse value out of line using sscanf
Make validity string all uppercase for comparisons using c_low2up
Read line containing projection parameters 1-3 using read_line
Parse values out of line using sscanf
Read line containing projection parameters 4-6 using read_line
Parse values out of line using sscanf
Read line containing projection parameters 7-9 using read_line
Parse values out of line using sscanf
Read line containing projection parameters 10-12 using read_line
Parse values out of line using sscanf
Read line containing projection parameters 13-15 using read_line
Parse values out of line using sscanf
Validate values using c_check_proj_params
13. get_corn_coords | ------> | This function retrieves the corner coordinates and corner coordinates validity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse value out of line using sscanf
Make validity string all uppercase for comparisons using c_low2up
Read line containing UL corner coordinates using read_line
Parse values out of line using sscanf
Read line containing UR corner coordinates using read_line
Parse values out of line using sscanf
Read line containing LL corner coordinates using read_line
Parse values out of line using sscanf
Read line containing LR corner coordinates using read_line
Parse values out of line using sscanf
Validate values
14. get_proj_dist | ------> | This function retrieves the projection distance and projection distance validity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse values out of line using sscanf
Make validity string all uppercase for comparisons using c_low2up
Validate values
15. get_proj_unit | ------> | This function retrieves the projection units and projection units validity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse values out of line using sscanf
Make strings all uppercase for comparisons using c_low2up
Validate values
16. get_inc | ------> | This function retrieves the line/sample increments and the line/sample increments' vaidity flag and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse values out of line using sscanf
Make validity string all uppercase for comparisons using c_low2up
Validate values
17. get_mast_coords | ------> | This function retrieves the master coordinates and validates them. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
Output Parameters: | struct DDR *ddr - Output DDR structure |
Return Type: | int (E_SUCC or E_FAIL) |
Parse values out of line using sscanf
Validate values
18. read_bddrs | ------> | This function reads the BDDR field values, validating each as it is read in. |
Input Parameters: | FILE *fp - File pointer to the ASCII DDR file to parse |
long nbands - Number of bands as specified by the DDR file | |
long dtype - Data type as specified by the DDR file | |
Output Parameters: | struct BDDR *bddrs - Output BDDR structures |
Return Type: | int (E_SUCC or E_FAIL) |
Skip image name line using skip_line
Read line containing band number using read_line
Parse value out of line using sscanf
Validate value
Skip blank line using skip_line
Read line containing min intensity value and validity flag using read_line
Parse values out of line using sscanf
Make validity string all uppercase for comparisons using c_low2up
Validate values
Read line containing max intensity value and validity flag using read_line
Parse values out of line using sscanf
Make validity string all uppercase for comparisons using c_low2up
Validate values
Skip blank line using skip_line
Read line containing data source using read_line
Determine if any value is specified using sscanf to retrieve first character
If the character is not a space parse the value out of line using sscanf
Read line containing sensor using read_line
Determine if any value is specified using sscanf to retrieve first character
If the character is not a space parse the value out of line using sscanf
Read line containing capture direction using read_line
Determine if any value is specified using sscanf to retrieve first character
If the character is not a space parse the value out of line using sscanf
Read line containing date of capture using read_line
Determine if any value is specified using sscanf to retrieve first character
If the character is not a space parse the value out of line using sscanf
Validate the date is in LAS date format
Read line containing time of capture using read_line
Determine if any value is specified using sscanf to retrieve first character
If the character is not a space parse the value out of line using sscanf
Validate the time is in LAS time format
Attempt to read next line using fgets to determine if there are more bddr records
If fgets failed determine if it was due to EOF or general failure using feof
19. signal_cleanup | ------> | Signal handling routine. |
Return Type: | void |
Exit
20. cleanup_files | ------> | This function removes the output DDR file that was created if the application gets terminated during processing and $DELFLG is set. |
Input Parameters: | char out_file[CMLEN] - name of the output DDR file |
Return Type: | void |