R/spatial.R
prj_auxiliary.Rd
Functions to get, set, transform and check presence of prj objects
rmf_get_prj(...) # S3 method for dis rmf_get_prj(dis) # S3 method for modflow rmf_get_prj(modflow) rmf_has_prj(...) # S3 method for dis rmf_has_prj(dis) # S3 method for modflow rmf_has_prj(modflow) rmf_set_prj(...) # S3 method for character rmf_set_prj(file, dis, prj = rmf_get_prj(dis)) # S3 method for dis rmf_set_prj(dis, prj) # S3 method for modflow rmf_set_prj(modflow, prj) rmf_transform_prj(...) # S3 method for prj rmf_transform_prj(prj, crs) # S3 method for dis rmf_transform_prj(dis, crs) # S3 method for modflow rmf_transform_prj(modflow, crs)
dis |
|
---|---|
modflow |
|
file | path to discretization file; typically "*.dis" |
prj |
|
crs | coordinate reference system to transform to. Input for |
rmf_get_prj
returns a RMODFLOW
prj object if present; otherwise NULL
rmf_has_prj
returns a logical depending on whether or not a RMODFLOW
prj object is present
rmf_set_prj
returns either a RMODFLOW
dis or modflow object with the prj set or nothing when writing directly to a file.
rmf_transform_prj
returns the RMODFLOW
object with a transformed crs in the prj
object
These functions can also be used with the RMT3DMS
library on btn
and mt3dms
objects.
If prj
information is already present, a warning is raised when overwriting.
rmf_set_prj.character
writes the projection information of prj
directly into the header comments of the discretization file
rmf_transform_prj
transforms the origin coordinates to the new crs. If no prj
was set, an error is raised.
#> RMODFLOW Projection object: #> Origin coordinates (x y z) of the lowerleft corner: #> -3591.308 -1590.759 0 #> Grid rotation (degrees counterclockwise): #> 0 #> Coordinate Reference System: #> NA#> RMODFLOW Projection object: #> Origin coordinates (x y z) of the lowerleft corner: #> 0 -1000 0 #> Grid rotation (degrees counterclockwise): #> 0 #> Coordinate Reference System: #> NA#> NULLrmf_has_prj(dis)#> [1] TRUErmf_has_prj(m)#> [1] TRUE#> [1] FALSE#> RMODFLOW Discretization File object with: #> 10 rows, 10 columns and 3 layers totalling 300 cells #> #> Time units: seconds #> Length units: meters #> #> Spacing along rows (DELR): 100 (constant) #> Spacing along columns (DELC): 100 (constant) #> #> Summary of top elevations: #> Top #> Min. :0 #> 1st Qu.:0 #> Median :0 #> Mean :0 #> 3rd Qu.:0 #> Max. :0 #> #> Summary of bottom elevations: #> Layer 1 Layer 2 Layer 3 #> Min. -10 -20 -30 #> 1st Qu. -10 -20 -30 #> Median -10 -20 -30 #> Mean -10 -20 -30 #> 3rd Qu. -10 -20 -30 #> Max. -10 -20 -30 #> #> Information for 1 stress-period: #> Period Length Timesteps Multiplier Type #> 1 1 1 1 Steady-state #> #> RMODFLOW Projection object: #> Origin coordinates (x y z) of the lowerleft corner: #> 100 -150 0 #> Grid rotation (degrees counterclockwise): #> 0 #> Coordinate Reference System: #> NA# write directly to header comments of file f <- tempfile() rmf_write_dis(dis, file = f) rmf_set_prj(f, dis, prj) rmf_read_dis(f)#> RMODFLOW Discretization File object with: #> 10 rows, 10 columns and 3 layers totalling 300 cells #> #> Time units: seconds #> Length units: meters #> #> Spacing along rows (DELR): 100 (constant) #> Spacing along columns (DELC): 100 (constant) #> #> Summary of top elevations: #> Top #> Min. :0 #> 1st Qu.:0 #> Median :0 #> Mean :0 #> 3rd Qu.:0 #> Max. :0 #> #> Summary of bottom elevations: #> Layer 1 Layer 2 Layer 3 #> Min. -10 -20 -30 #> 1st Qu. -10 -20 -30 #> Median -10 -20 -30 #> Mean -10 -20 -30 #> 3rd Qu. -10 -20 -30 #> Max. -10 -20 -30 #> #> Information for 1 stress-period: #> Period Length Timesteps Multiplier Type #> 1 1 1 1 Steady-state #> #> RMODFLOW Projection object: #> Origin coordinates (x y z) of the lowerleft corner: #> 100 -150 0 #> Grid rotation (degrees counterclockwise): #> 0 #> Coordinate Reference System: #> NAprj <- rmf_create_prj(origin = c(152082, 168000.2), rotation = -12, crs = 31370) dis <- rmf_create_dis(prj = prj) rmf_transform_prj(prj, crs = 4326)#> Warning: RMODFLOW does not work optimally for geographic coordinates. Please consider using a projected crs.#> RMODFLOW Projection object: #> Origin coordinates (x y z) of the lowerleft corner: #> 4.3983 50.82243 0 #> Grid rotation (degrees counterclockwise): #> -12 #> Coordinate Reference System: #> EPSG: 4326 #> proj4string: +proj=longlat +datum=WGS84 +no_defsrmf_transform_prj(dis, crs = 3044)#> RMODFLOW Discretization File object with: #> 10 rows, 10 columns and 3 layers totalling 300 cells #> #> Time units: seconds #> Length units: meters #> #> Spacing along rows (DELR): 100 (constant) #> Spacing along columns (DELC): 100 (constant) #> #> Summary of top elevations: #> Top #> Min. :0 #> 1st Qu.:0 #> Median :0 #> Mean :0 #> 3rd Qu.:0 #> Max. :0 #> #> Summary of bottom elevations: #> Layer 1 Layer 2 Layer 3 #> Min. -10 -20 -30 #> 1st Qu. -10 -20 -30 #> Median -10 -20 -30 #> Mean -10 -20 -30 #> 3rd Qu. -10 -20 -30 #> Max. -10 -20 -30 #> #> Information for 1 stress-period: #> Period Length Timesteps Multiplier Type #> 1 1 1 1 Steady-state #> #> RMODFLOW Projection object: #> Origin coordinates (x y z) of the lowerleft corner: #> 175939.9 5640176 0 #> Grid rotation (degrees counterclockwise): #> -12 #> Coordinate Reference System: #> EPSG: 3044 #> proj4string: +proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs