Skip to content

Commit

Permalink
Update DGGRID and use sf
Browse files Browse the repository at this point in the history
  • Loading branch information
r-barnes committed Oct 31, 2021
1 parent ec2a040 commit 6d9129a
Show file tree
Hide file tree
Showing 271 changed files with 16,142 additions and 10,294 deletions.
10 changes: 9 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
dggridR.*.tar.gz
wintest
NOTES
dggridR.Rcheck
dggridR.Rcheck/
src/.*\.o$
src/.*\.depends$
src/.*\.a$
Expand All @@ -12,7 +12,15 @@ src/apps/dggrid/dggrid$
src/clean$
src/Makefile
src/misc
src/func_gen.py
mailinglist
LICENSE
^doc$
^Meta$
submodules/
update_from_upstream.sh
CONTRIBUTING.md
copy_to_src/
build/
.vscode/
CMakeLists.txt
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ LICENCE
*.so
doc
Meta
build/
.vscode/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/DGGRID"]
path = submodules/DGGRID
url = [email protected]:r-barnes/DGGRID.git
123 changes: 123 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
cmake_minimum_required (VERSION 3.9)

project(dggridR
LANGUAGES C CXX
)

file(GLOB SRC_FILES src/*.{c,cpp})

add_executable(dggridR
src/adjlon.cpp
src/DgAddressBase.cpp
src/DgApSeq.cpp
src/DgBase.cpp
src/DgBoundedHexC2RF2D.cpp
src/DgBoundedHexC3C2RF2D.cpp
src/DgBoundedHexC3RF2D.cpp
src/DgBoundedIDGG.cpp
src/DgBoundedIDGGS.cpp
src/DgBoundedRF2D.cpp
src/DgBoundedRFBase0.cpp
src/DgBoundedRFS2D.cpp
src/DgCell.cpp
src/DgColor.cpp
src/DgConverterBase.cpp
src/DgDiscRFS2D.cpp
src/DgDistanceBase.cpp
src/DgDmdD4Grid2D.cpp
src/DgDmdD4Grid2DS.cpp
src/DgDmdD8Grid2D.cpp
src/DgDmdD8Grid2DS.cpp
src/DgDmdIDGG.cpp
src/DgDVec2D.cpp
src/DgDVec3D.cpp
src/DgEllipsoidRF.cpp
src/DgGeoSphRF.cpp
src/DgGridTopo.cpp
src/DgHexC1Grid2D.cpp
src/DgHexC2Grid2D.cpp
src/DgHexC3Grid2D.cpp
src/DgHexGrid2DS.cpp
src/DgHexIDGG.cpp
src/DgHexIDGGS.cpp
src/DgIcosaMap.cpp
src/DgIDGGBase.cpp
src/DgIDGG.cpp
src/DgIDGGS3H.cpp
src/DgIDGGS43H.cpp
src/DgIDGGS4D.cpp
src/DgIDGGS4H.cpp
src/DgIDGGS4T.cpp
src/DgIDGGSBase.cpp
src/DgIDGGS.cpp
src/DgIDGGutil.cpp
src/DgInAIGenFile.cpp
src/DgInGDALFile.cpp
src/DgInLocTextFile.cpp
src/DgInputStream.cpp
src/DgInShapefileAtt.cpp
src/DgInShapefile.cpp
src/DgIVec2D.cpp
src/DgIVec3D.cpp
src/dglib.cpp
src/DgLocation.cpp
src/DgLocBase.cpp
src/DgLocList.cpp
src/DgLocVector.cpp
src/DgOutAIGenFile.cpp
src/DgOutChildrenFile.cpp
src/DgOutGdalFile.cpp
src/DgOutGeoJSONFile.cpp
src/DgOutKMLfile.cpp
src/DgOutLocFile.cpp
src/DgOutLocTextFile.cpp
src/DgOutNeighborsFile.cpp
src/DgOutPRCellsFile.cpp
src/DgOutPRPtsFile.cpp
src/DgOutPtsText.cpp
src/DgOutputStream.cpp
src/DgOutRandPtsText.cpp
src/DgOutShapefile.cpp
src/DgParamList.cpp
src/DgPolygon.cpp
src/DgProjFuller.cpp
src/DgProjGnomonicRF.cpp
src/DgProjISEA.cpp
src/DgProjTriRF.cpp
src/DgRandom.cpp
src/DgRFBase.cpp
src/DgRFNetwork.cpp
src/DgSeriesConverter.cpp
src/DgSqrD4Grid2D.cpp
src/DgSqrD4Grid2DS.cpp
src/DgSqrD8Grid2D.cpp
src/DgSqrD8Grid2DS.cpp
src/DgSuperfund.cpp
src/DgTriGrid2D.cpp
src/DgTriGrid2DS.cpp
src/DgTriIDGG.cpp
src/DgUtil.cpp
src/emess.cpp
src/pj_auth.cpp
src/pj_mlfn.cpp
src/pj_msfn.cpp
src/pj_phi2.cpp
src/pj_qsfn.cpp
src/pj_tsfn.cpp
# src/RcppExports.cpp
# src/Rwrapper.cpp
src/dbfopen.c
src/safileio.c
src/sbnsearch.c
src/shpopen.c
src/shptree.c
src/util.cpp
src/test.cpp
)
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
target_compile_options(dggridR PRIVATE -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-deprecated-copy -Wstringop-truncation) # -fsanitize=address)
target_include_directories(dggridR
PRIVATE
/usr/share/R/include/
/home/rick/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include
)
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Structure
=============================================

dggridR consists of several parts connected together with a discomforting amount of duct tape and superglue. These parts are assembled into a directory called `src` which is designed to be nuke-able.

These parts are:
* `submodules/DGGRID` - The upstream engine for manipulating discrete global grids
* `copy_to_src/dglib.{cpp,h}` - A simplifying layer of C++
* `copy_to_src/Rwrapper.{h,cpp}` - Code that wraps `dglib.{cpp,h}` for use with R
* `copy_to_src/cgen_{head,body,funcs}.h` - Full-factorial coordinate conversion code generated with `copy_to_src/func_gen.py`
* `copy_to_src/func_gen.py` - Autogenerates full-factorial coordinate conversion code
* `./update_from_upstream.h` - Copies the appropriate files from `submodules/DGGRID` into `src/`

Why do we have to do this copying? Because R's build model is pretty terrible: it assumes all the code lives in the same directory. If you want a reasonable, subdirectory-based organization of your code things become very painful.
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Package: dggridR
Type: Package
Title: Discrete Global Grids
Version: 2.0.8
Date: 2020-11-25
Version: 3.0.0
Date: 2021-10-31
Author: Richard Barnes [aut, cre], Kevin Sahr [aut, cph], Gerald Evenden [cph], Angus Johnson [cph], Frank Warmerdam [cph], Even Rouault [cph], Lian Song [ctb]
Maintainer: Richard Barnes <[email protected]>
NeedsCompilation: yes
Depends: R (>= 3.4.0), rgdal (>= 1.1), ggplot2 (>= 2.1), dplyr (>= 0.4), sp (>= 1.2)
Suggests: knitr,
Depends: R (>= 3.4.0), dplyr (>= 0.4), rlang (>= 0.4), sf (>= 1.0), sp (>= 1.2)
Suggests: ggplot2,
knitr,
rmarkdown,
maps,
mapproj,
Expand All @@ -30,6 +31,6 @@ Imports:
methods (>= 3.4.0)
LinkingTo: Rcpp
RcppModules: dgfuncs, gridgens, gridstats
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
VignetteBuilder: knitr, R.rsp
SystemRequirements: C++11
6 changes: 2 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ export(dgmaxcell)
export(dgrectgrid)
export(dgsetres)
export(dgshptogrid)
export(dgtransform)
export(dgverify)
import(dplyr)
import(sf)
import(sp)
importFrom(ggplot2,fortify)
importFrom(methods,as)
importFrom(rgdal,readOGR)
importFrom(rgdal,writeOGR)
importFrom(rlang,.data)
importFrom(utils,read.csv)
importFrom(utils,read.table)
importFrom(utils,tail)
Expand Down
26 changes: 16 additions & 10 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
dggridR v3.0.0 (Release date: 2021-10-31)
===============
* Fixes memory leaks in DGGRID
* Switches to using sf package from rgdal
* Removed `dgtransform`, which was previously deprecated. Use `dgGEO_to_SEQNUM` instead.

dggridR v2.0.8 (Release date: 2020-11-25)
===============
* Still trying to get CRAN upload to work
Expand All @@ -12,23 +18,23 @@ dggridR v2.0.6 (Release date: 2020-10-15)

dggridR v2.0.5 (Release date: 2020-04-30)
===============
*Update authorship information
* Update authorship information

dggridR v2.0.4 (Release date: 2020-04-29)
===============
*Fix some new warnings identified by CRAN's updated compilers.
*Added doi
*Updated shapelib
* Fix some new warnings identified by CRAN's updated compilers.
* Added doi
* Updated shapelib


dggridR v2.0.3 (Release date: 2018-04-04)
===============
*Fix bugs in dgshptogrid() and dgrectgrid() with cellsize not being respected
*Updated authorship info for accuracy
*More helpful warning messages
*CRAN-compliant package title
*Adjusted function documentation to match behaviour
*Fixed issue with default value of `savegrid`
* Fix bugs in dgshptogrid() and dgrectgrid() with cellsize not being respected
* Updated authorship info for accuracy
* More helpful warning messages
* CRAN-compliant package title
* Adjusted function documentation to match behaviour
* Fixed issue with default value of `savegrid`


dggridR v2.0.2 (Release date: 2017-08-19)
Expand Down
Loading

0 comments on commit 6d9129a

Please sign in to comment.