Soil Water Balance (SWB2)
|
Provides support for input and output of gridded ASCII data, as well as for creation and destruction of grid data structures (defined types). More...
Data Types | |
type | general_grid_t |
type | grid_bounds_t |
interface | grid_create |
interface | pj_init_and_transform |
interface to C code that provides a simplified entry point to PROJ4 capabilities: it has been modified so that all C pointers are kept within the C code; no pointers are returned to fortran More... |
Functions/Subroutines | |
subroutine, public | grid_set_output_directory_name (sdirname) |
type(general_grid_t) function, pointer, public | grid_createcomplete (inx, iny, rx0, ry0, rx1, ry1, idatatype) |
Creates a grid of a specified type. | |
type(general_grid_t) function, pointer, public | grid_createsimple (inx, iny, rx0, ry0, rgridcellsize, idatatype) |
subroutine, public | grid_destroy (pgrd) |
type(general_grid_t) function, pointer, public | grid_read (sfilename, sfiletype, idatatype) |
subroutine, public | grid_readexisting (sfilename, sfiletype, pgrd) |
type(general_grid_t) function, pointer | grid_readarcgrid_fn (sfilename, idatatype) |
subroutine | grid_readarcgrid_sub (sfilename, pgrd) |
type(general_grid_t) function, pointer | grid_readsurfergrid_fn (sfilename, idatatype) |
subroutine | grid_readsurfergrid_sub (sfilename, pgrd) |
subroutine, public | grid_writegrid (sfilename, pgrd, ioutputformat) |
subroutine, public | grid_writearcgrid (sfilename, pgrd) |
subroutine, public | grid_writesurfergrid (sfilename, pgrd) |
logical(c_bool) function, public | grid_conform (pgrd1, pgrd2, rtolerance) |
logical(c_bool) function, public | grid_completelycover (pbasegrd, pothergrd, rtolerance) |
subroutine | grid_lookupcolumn (pgrd, rxval, ibefore, iafter, rfrac) |
subroutine | grid_lookuprow (pgrd, ryval, ibefore, iafter, rfrac) |
subroutine, public | grid_transform (pgrd, sfromproj4, stoproj4, rx, ry) |
Call PROJ4 to transform coordinates. | |
subroutine | grid_checkintegergridvalues (pgrd, sfilename) |
subroutine, public | grid_checkforproj4error (iretval, sfromproj4, stoproj4) |
real(c_float) function, public | grid_interpolate (pgrd, rxval, ryval) |
real(c_float) function | grid_searchcolumn (pgrd, rxval, rzval, rnodata) |
real(c_float) function | grid_lookupreal (pgrd, rxval, ryval) |
logical(c_bool) function, public | grid_coordinatesfallinsidegrid (pgrd, rx, ry) |
logical(c_bool) function, public | grid_rowcolfallsinsidegrid (pgrd, irow, icol) |
integer(c_int) function, public | grid_getgridcolnum (pgrd, rx) |
integer(c_int) function, public | grid_getgridrownum (pgrd, ry) |
integer(c_int) function, dimension(2) | grid_getgridcolrownum (pgrd, rx, ry) |
subroutine, public | grid_set_nodata_value (pgrd, ivalue, fvalue) |
real(c_double) function, public | grid_getgridx (pgrd, icolumnnumber) |
real(c_double) function, public | grid_getgridy (pgrd, irownumber) |
subroutine, public | grid_populatexy (pgrd, rx, ry) |
subroutine, public | grid_dumpgridextent (pgrd) |
integer(c_int) function | grid_gridtopoint_int (pgrdfrom, pgrdto, icol, irow) |
subroutine, public | grid_gridtogrid_int (pgrdfrom, pgrdto, lusemajorityfilter) |
subroutine, public | grid_gridtogrid_sgl (pgrdfrom, pgrdto) |
integer(c_int) function | grid_majorityfilter_int (pgrdfrom, itargetcol, itargetrow, inodatavalue, ispread) |
real(c_float) function | grid_convolve_sgl (pgrdfrom, itargetcol, itargetrow, rkernel, rnodatavalue) |
Variables | |
integer(c_int), parameter, public | grid_nodata_int = -9999_c_int |
real(c_float), parameter, public | grid_nodata_real = -9999._c_float |
real(c_double), parameter, public | grid_nodata_double = -9999._c_double |
integer(c_int), parameter, public | grid_datatype_int = DATATYPE_INT |
integer(c_int), parameter, public | grid_datatype_real = DATATYPE_REAL |
integer(c_int), parameter, public | grid_datatype_double = DATATYPE_DOUBLE |
integer(c_int), parameter, public | output_surfer = 0 |
integer(c_int), parameter, public | output_arc = 1 |
integer(c_int), parameter, public | grid_active_cell = 1 |
integer(c_int), parameter | nc_fill_int = GRID_NODATA_INT |
real(c_float), parameter | nc_fill_float = GRID_NODATA_REAL |
real(c_double), parameter | nc_fill_double = GRID_NODATA_DOUBLE |
type(error_message_t), dimension(49) | terrormessage = (/ ERROR_MESSAGE_T("no arguments in initialization list ", -1), ERROR_MESSAGE_T("no options found in 'init' file ", -2), ERROR_MESSAGE_T("no colon in init= string ", -3), ERROR_MESSAGE_T("projection not named ", -4), ERROR_MESSAGE_T("unknown projection id ", -5), ERROR_MESSAGE_T("effective eccentricity = 1. ", -6), ERROR_MESSAGE_T("unknown unit conversion id ", -7), ERROR_MESSAGE_T("invalid boolean param argument ", -8), ERROR_MESSAGE_T("unknown elliptical parameter name ", -9), ERROR_MESSAGE_T("reciprocal flattening (1/f) = 0 ", -10), ERROR_MESSAGE_T("|radius reference latitude| > 90 ", -11), ERROR_MESSAGE_T("squared eccentricity < 0 ", -12), ERROR_MESSAGE_T("major axis or radius = 0 or not given ", -13), ERROR_MESSAGE_T("latitude or longitude exceeded limits ", -14), ERROR_MESSAGE_T("invalid x or y ", -15), ERROR_MESSAGE_T("improperly formed DMS value ", -16), ERROR_MESSAGE_T("non-convergent inverse meridional dist ", -17), ERROR_MESSAGE_T("non-convergent inverse phi2 ", -18), ERROR_MESSAGE_T("acos/asin: |arg| >1.+1e-14 ", -19), ERROR_MESSAGE_T("tolerance condition error ", -20), ERROR_MESSAGE_T("conic lat_1 = -lat_2 ", -21), ERROR_MESSAGE_T("lat_1 >= 90 ", -22), ERROR_MESSAGE_T("lat_1 = 0 ", -23), ERROR_MESSAGE_T("lat_ts >= 90 ", -24), ERROR_MESSAGE_T("no distance between control points ", -25), ERROR_MESSAGE_T("projection not selected to be rotated ", -26), ERROR_MESSAGE_T("W <= 0 or M <= 0 ", -27), ERROR_MESSAGE_T("lsat not in 1-5 range ", -28), ERROR_MESSAGE_T("path not in range ", -29), ERROR_MESSAGE_T("h <= 0 ", -30), ERROR_MESSAGE_T("k <= 0 ", -31), ERROR_MESSAGE_T("lat_0 = 0 or 90 or alpha = 90 ", -32), ERROR_MESSAGE_T("lat_1=lat_2 or lat_1=0 or lat_2=90 ", -33), ERROR_MESSAGE_T("elliptical usage required ", -34), ERROR_MESSAGE_T("invalid UTM zone number ", -35), ERROR_MESSAGE_T("arg(s) out of range for Tcheby eval ", -36), ERROR_MESSAGE_T("failed to find projection to be rotated ", -37), ERROR_MESSAGE_T("failed to load datum shift file ", -38), ERROR_MESSAGE_T("both n ), & m must be spec'd and > 0 ", -39), ERROR_MESSAGE_T("n <= 0, n > 1 or not specified ", -40), ERROR_MESSAGE_T("lat_1 or lat_2 not specified ", -41), ERROR_MESSAGE_T("|lat_1| == |lat_2| ", -42), ERROR_MESSAGE_T("lat_0 is pi/2 from mean lat ", -43), ERROR_MESSAGE_T("unparseable coordinate system definition ", -44), ERROR_MESSAGE_T("geocentric transformation missing z or ellps ", -45), ERROR_MESSAGE_T("unknown prime meridian conversion id ", -46), ERROR_MESSAGE_T("illegal axis orientation combination ", -47), ERROR_MESSAGE_T("point not within available datum shift grids ", -48), ERROR_MESSAGE_T("invalid sweep axis, choose x or y ", -49) /) |
integer(c_int), parameter | four_cells = 1 |
integer(c_int), parameter | eight_cells = 2 |
integer(c_int), parameter, private | column = 1 |
integer(c_int), parameter, private | row = 2 |
integer(c_int) | lu_temp |
integer(c_int) | lu_grid |
character(len=256) | output_grid_directory_name = "" |
Provides support for input and output of gridded ASCII data, as well as for creation and destruction of grid data structures (defined types).
subroutine, public grid::grid_checkforproj4error | ( | integer (c_int) | iretval, |
character (len=*) | sfromproj4, | ||
character (len=*) | stoproj4 ) |
|
private |
logical (c_bool) function, public grid::grid_completelycover | ( | type (general_grid_t), pointer | pbasegrd, |
type (general_grid_t), pointer | pothergrd, | ||
real (c_float), intent(in), optional | rtolerance ) |
logical (c_bool) function, public grid::grid_conform | ( | type (general_grid_t), pointer | pgrd1, |
type (general_grid_t), pointer | pgrd2, | ||
real (c_float), intent(in), optional | rtolerance ) |
|
private |
logical (c_bool) function, public grid::grid_coordinatesfallinsidegrid | ( | type ( general_grid_t ), pointer | pgrd, |
real (c_double) | rx, | ||
real (c_double) | ry ) |
type (general_grid_t) function, pointer, public grid::grid_createcomplete | ( | integer (c_int), intent(in) | inx, |
integer (c_int), intent(in) | iny, | ||
real (c_double), intent(in) | rx0, | ||
real (c_double), intent(in) | ry0, | ||
real (c_double), intent(in) | rx1, | ||
real (c_double), intent(in) | ry1, | ||
integer (c_int), intent(in) | idatatype ) |
Creates a grid of a specified type.
Creates a grid pointer object and allocates memory for the data associated with the grid (REAL, INTEGER, or T_CELL).
iNX | Number of grid cells in the x direction |
iNY | Number of grid cells in the y direction |
rX0 | X coordinate for the lower left corner of the grid |
rY0 | Y coordinate for the lower left corner of the grid |
rX1 | X coordinate for the upper right corner of the grid |
rY1 | Y coordinate for the upper right corner of the grid |
iDataType | Integer value corresponding to the type of data contained in the grid |
type (general_grid_t) function, pointer, public grid::grid_createsimple | ( | integer (c_int), intent(in) | inx, |
integer (c_int), intent(in) | iny, | ||
real (c_double), intent(in) | rx0, | ||
real (c_double), intent(in) | ry0, | ||
real (c_double), intent(in) | rgridcellsize, | ||
integer (c_int), intent(in) | idatatype ) |
subroutine, public grid::grid_destroy | ( | type ( general_grid_t ), pointer | pgrd | ) |
subroutine, public grid::grid_dumpgridextent | ( | type ( general_grid_t ), pointer | pgrd | ) |
integer (c_int) function, public grid::grid_getgridcolnum | ( | type ( general_grid_t ), pointer | pgrd, |
real (c_double) | rx ) |
|
private |
integer (c_int) function, public grid::grid_getgridrownum | ( | type ( general_grid_t ), pointer | pgrd, |
real (c_double) | ry ) |
real (c_double) function, public grid::grid_getgridx | ( | type ( general_grid_t ), pointer | pgrd, |
integer (c_int) | icolumnnumber ) |
real (c_double) function, public grid::grid_getgridy | ( | type ( general_grid_t ), pointer | pgrd, |
integer (c_int) | irownumber ) |
subroutine, public grid::grid_gridtogrid_int | ( | type ( general_grid_t ), pointer | pgrdfrom, |
type ( general_grid_t ), pointer | pgrdto, | ||
logical (c_bool), intent(in) | lusemajorityfilter ) |
subroutine, public grid::grid_gridtogrid_sgl | ( | type ( general_grid_t ), pointer | pgrdfrom, |
type ( general_grid_t ), pointer | pgrdto ) |
|
private |
real (c_float) function, public grid::grid_interpolate | ( | type ( general_grid_t ), pointer | pgrd, |
real (c_float), intent(in) | rxval, | ||
real (c_float), intent(in) | ryval ) |
|
private |
|
private |
|
private |
|
private |
subroutine, public grid::grid_populatexy | ( | type ( general_grid_t ), pointer | pgrd, |
real (c_double), dimension(:), optional | rx, | ||
real (c_double), dimension(:), optional | ry ) |
type (general_grid_t) function, pointer, public grid::grid_read | ( | character (len=*), intent(in) | sfilename, |
character (len=*), intent(in) | sfiletype, | ||
integer (c_int), intent(in) | idatatype ) |
|
private |
|
private |
subroutine, public grid::grid_readexisting | ( | character (len=*), intent(in) | sfilename, |
character (len=*), intent(in) | sfiletype, | ||
type (general_grid_t), pointer | pgrd ) |
|
private |
|
private |
logical (c_bool) function, public grid::grid_rowcolfallsinsidegrid | ( | type ( general_grid_t ), pointer | pgrd, |
integer (c_int) | irow, | ||
integer (c_int) | icol ) |
|
private |
subroutine, public grid::grid_set_nodata_value | ( | type ( general_grid_t ), pointer | pgrd, |
integer (c_int), intent(in), optional | ivalue, | ||
real (c_float), intent(in), optional | fvalue ) |
subroutine, public grid::grid_set_output_directory_name | ( | character (len=*), intent(in) | sdirname | ) |
subroutine, public grid::grid_transform | ( | type ( general_grid_t ), pointer | pgrd, |
character (len=*) | sfromproj4, | ||
character (len=*) | stoproj4, | ||
real (c_double), dimension(:), optional | rx, | ||
real (c_double), dimension(:), optional | ry ) |
Call PROJ4 to transform coordinates.
This subroutine calls a Fortran wrapper to the C library PROJ4. A set of input coordinates is transformed to the base SWB coordinate system.
The idea is to first create a 2D array of the X and Y coordinates in the projection system of the input data set. These coordinate values are then fed to PROJ4, which modifies the values and returns the coordinate values in the projection system of the base grid. Thereafter, mapping source to target is a matter of finding the value of the cell closest to a SWB grid coordinate pair.
[in,out] | pGrd | |
[in] | sFromPROJ4 | |
[in] | sToPROJ4 |
supply X and Y for the untransformed data
calculate X and Y for the untransformed data
PROJ4 expects unprojected coordinates (i.e. lat lon) to be provided in RADIANS. Therefore, we convert to radians prior to the call...
If the coordinates have been converted TO latlon, convert back to degrees
Definition at line 1539 of file grid.F90.
subroutine, public grid::grid_writearcgrid | ( | character (len=*), intent(in) | sfilename, |
type (general_grid_t), pointer | pgrd ) |
subroutine, public grid::grid_writegrid | ( | character (len=*), intent(in) | sfilename, |
type (general_grid_t), pointer | pgrd, | ||
integer (c_int) | ioutputformat ) |
subroutine, public grid::grid_writesurfergrid | ( | character (len=*), intent(in) | sfilename, |
type (general_grid_t), pointer | pgrd ) |
|
private |
integer (c_int), parameter, public grid::grid_active_cell = 1 |
integer (c_int), parameter, public grid::grid_datatype_double = DATATYPE_DOUBLE |
integer (c_int), parameter, public grid::grid_datatype_int = DATATYPE_INT |
integer (c_int), parameter, public grid::grid_datatype_real = DATATYPE_REAL |
real (c_double), parameter, public grid::grid_nodata_double = -9999._c_double |
integer (c_int), parameter, public grid::grid_nodata_int = -9999_c_int |
real (c_float), parameter, public grid::grid_nodata_real = -9999._c_float |
|
private |
|
private |
|
private |
|
private |
|
private |
type(error_message_t), dimension(49) grid::terrormessage = (/ ERROR_MESSAGE_T("no arguments in initialization list ", -1), ERROR_MESSAGE_T("no options found in 'init' file ", -2), ERROR_MESSAGE_T("no colon in init= string ", -3), ERROR_MESSAGE_T("projection not named ", -4), ERROR_MESSAGE_T("unknown projection id ", -5), ERROR_MESSAGE_T("effective eccentricity = 1. ", -6), ERROR_MESSAGE_T("unknown unit conversion id ", -7), ERROR_MESSAGE_T("invalid boolean param argument ", -8), ERROR_MESSAGE_T("unknown elliptical parameter name ", -9), ERROR_MESSAGE_T("reciprocal flattening (1/f) = 0 ", -10), ERROR_MESSAGE_T("|radius reference latitude| > 90 ", -11), ERROR_MESSAGE_T("squared eccentricity < 0 ", -12), ERROR_MESSAGE_T("major axis or radius = 0 or not given ", -13), ERROR_MESSAGE_T("latitude or longitude exceeded limits ", -14), ERROR_MESSAGE_T("invalid x or y ", -15), ERROR_MESSAGE_T("improperly formed DMS value ", -16), ERROR_MESSAGE_T("non-convergent inverse meridional dist ", -17), ERROR_MESSAGE_T("non-convergent inverse phi2 ", -18), ERROR_MESSAGE_T("acos/asin: |arg| >1.+1e-14 ", -19), ERROR_MESSAGE_T("tolerance condition error ", -20), ERROR_MESSAGE_T("conic lat_1 = -lat_2 ", -21), ERROR_MESSAGE_T("lat_1 >= 90 ", -22), ERROR_MESSAGE_T("lat_1 = 0 ", -23), ERROR_MESSAGE_T("lat_ts >= 90 ", -24), ERROR_MESSAGE_T("no distance between control points ", -25), ERROR_MESSAGE_T("projection not selected to be rotated ", -26), ERROR_MESSAGE_T("W <= 0 or M <= 0 ", -27), ERROR_MESSAGE_T("lsat not in 1-5 range ", -28), ERROR_MESSAGE_T("path not in range ", -29), ERROR_MESSAGE_T("h <= 0 ", -30), ERROR_MESSAGE_T("k <= 0 ", -31), ERROR_MESSAGE_T("lat_0 = 0 or 90 or alpha = 90 ", -32), ERROR_MESSAGE_T("lat_1=lat_2 or lat_1=0 or lat_2=90 ", -33), ERROR_MESSAGE_T("elliptical usage required ", -34), ERROR_MESSAGE_T("invalid UTM zone number ", -35), ERROR_MESSAGE_T("arg(s) out of range for Tcheby eval ", -36), ERROR_MESSAGE_T("failed to find projection to be rotated ", -37), ERROR_MESSAGE_T("failed to load datum shift file ", -38), ERROR_MESSAGE_T("both n ), & m must be spec'd and > 0 ", -39), ERROR_MESSAGE_T("n <= 0, n > 1 or not specified ", -40), ERROR_MESSAGE_T("lat_1 or lat_2 not specified ", -41), ERROR_MESSAGE_T("|lat_1| == |lat_2| ", -42), ERROR_MESSAGE_T("lat_0 is pi/2 from mean lat ", -43), ERROR_MESSAGE_T("unparseable coordinate system definition ", -44), ERROR_MESSAGE_T("geocentric transformation missing z or ellps ", -45), ERROR_MESSAGE_T("unknown prime meridian conversion id ", -46), ERROR_MESSAGE_T("illegal axis orientation combination ", -47), ERROR_MESSAGE_T("point not within available datum shift grids ", -48), ERROR_MESSAGE_T("invalid sweep axis, choose x or y ", -49) /) |