Comments (8)
Done. Removed nm_StudyAreaExtent
from the aquatic branch, as its no longer needed.
from regional_sdm.
Is this necessary to save it, if it's only used in the map(?) Seems it could be generated on the fly just in step 5.
Terrestrial already has methods in helper/crop_rast_mask.r
, to pull from a huc10 shapefile:
db <- dbConnect(SQLite(),dbname=nm_db_file)
SQLquery <- paste0("SELECT huc10_id from lkpRange
inner join lkpSpecies on lkpRange.EGT_ID = lkpSpecies.EGT_ID
where lkpSpecies.sp_code = '", model_species, "';")
hucList <- dbGetQuery(db, statement = SQLquery)$huc10_id
dbDisconnect(db)
rm(db)
# now get that info spatially
nm_range <- nm_HUC_file
qry <- paste("SELECT * from HUC10 where HUC10 IN ('", paste(hucList, collapse = "', '"), "')", sep = "")
hucRange <- st_zm(st_read(nm_range, query = qry))
One option to have consistent aquatic/terrestrial methods here would be to calculate and write the huc10
s values (that make up the aquatic range) to lkpRange
.
from regional_sdm.
I did not know about that happening in Terrestrial. I was saving it, as I thought it could be useful as a standalone product. I had thought of just making it a temporary file.
from regional_sdm.
Sounds good, saving a shapefile probably is a good idea.
We could also adjust terrestrial methods to pull from the huc12 table you generated, if there are not concerns about differences between versions as discussed yesterday in #62.
from regional_sdm.
In order to make a layer of HUC10s that match the aquatic ranges for the model review tool, I've been trying to dissolve the by the HUC10 column using sf
without success. @tghoward and @dnbucklin, do you have any experience with this?
from regional_sdm.
If I'm understanding correctly I think dplyr
is the way to go for something like this:
library(sf)
library(dplyr)
huc <- st_read("hucs.shp")
names(huc)
# use your huc10 field in group_by, geometry field in st_union
huc10 <- huc %>% group_by(HUC_10) %>% summarize(geometry = st_union(geometry))
from regional_sdm.
Thanks @dnbucklin! I had most of it together, but I was trying to use a different group_by
approach. This works a lot better and cleaner than my draft code.
from regional_sdm.
Note that dplyr
has to loaded before sf
for this to work.
from regional_sdm.
Related Issues (20)
- correlation level for correlated vars? HOT 6
- encoding error HOT 10
- subset data for pplots HOT 2
- Writing the Aquatic metadata map is really slow for large areas under tmap HOT 3
- mtry: reset to valid range HOT 3
- add test for GDAL on the Path HOT 1
- camelCase variables in `background_CONUS.sqlite` causing dropped variables in metadata in 3_createModel.R HOT 2
- AquaGroup: incorrect cutoff specified HOT 10
- AquaGroup: sampsize larger than class HOT 1
- Aquatics: query to select EnvVars for predict is grabbing all EnvVars
- df.in2 not found HOT 4
- timestamp in name in output files
- area -based subsampling
- handle nulls AND blanks in correlated vars table
- group and clean polys in prep
- rework parallel sections
- stars package integrating for faster raster processing HOT 2
- Discussion: Adding embedded metadata into the tiff files HOT 1
- xgb doesn't like model saving within RData file
- current version in terrestrial doesn't handle raster subfolders when cropping
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from regional_sdm.