GithubHelp home page GithubHelp logo

Comments (17)

mikewessel avatar mikewessel commented on July 30, 2024

Use creek_pop.sas7bdat file WBID field in tbeptools as list or in one to many join to subset data based on WBIDs within SW FL tidal creeks population

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

@mikewessel is this the only step to distill the entire run 56 database to iwr56_tidalcreeks.sas7bdat?

from tbeptools.

mikewessel avatar mikewessel commented on July 30, 2024

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

@mikewessel partially there, but running into memory issues on import...

# specify run
run <- 'run60'

# check if url exists
url <- paste0('http://publicfiles.dep.state.fl.us/dear/kristin/', run, '/')
urlexst <- RCurl::url.exists(url)
if(!urlext)
  stop('URL for ', url, ' doesnt exist')

# get file list, probably overkill because the file name doesn't change
fls <- RCurl::getURL(url, verbose = T, ftp.use.epsv = F, dirlistonly = T, crlf = T)
zip <- gsub('^.*\\">(.*\\.zip)<.*$', '\\1', fls)
zip <- paste0(url, zip)

# download and unzip to temp directory
tmp1 <- tempfile()
tmp2 <- tempfile()
download.file(zip, destfile = tmp1)
unzip(tmp1, exdir = tmp2)

# attempt to read sas file
dat <- haven::read_sas(list.files(tmp2, full.names = T))
### Error: cannot allocate vector of size 318.8 Mb

from tbeptools.

mikewessel avatar mikewessel commented on July 30, 2024

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

Spent most of the morning trying to get this working, but no luck yet: https://github.com/bnosac/spark.sas7bdat

Even if it does work, it would probably take some effort to make it portable (i.e., automate on different machines). I still think it's worth getting setup though...

from tbeptools.

mikewessel avatar mikewessel commented on July 30, 2024

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

@mikewessel do you think it's feasible for them to upload a text file? Wouldn't that be much larger than the SAS file?

I'd rather not go the Access route. I've done it but it makes the workflow so much more vulnerable.

from tbeptools.

mikewessel avatar mikewessel commented on July 30, 2024

from tbeptools.

mikewessel avatar mikewessel commented on July 30, 2024

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

@mikewessel I think the data.table package is the way to go for large text files. I can get it manageable using this code. Is the text file something that DEP can host?

library(data.table)
library(tbeptools)

tmp <- fread('~/Desktop/iwr2002_pv.txt', sep = '\t')
tmp2 <- tmp[wbid %in% tidalcreeks$wbid, c('wbid', 'class', 'sta', 'year', 'month', 'day', 'time', 'depth', 'depth2', 'param', 'masterCode', 'result')]

rm(list = 'tmp')

save(tmp2, file = 'data/tmp2.RData', compress = 'xz')

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

This may be possible to query through Water Atlas:

From Adok:

We currently have the Impaired Waters data as a part of the Water Bodies WaterQuality API. It is currently bundled and query-able by Waterbody id within the water atlas.

Here is the API: https://api.wateratlas.usf.edu/sandbox/index#!/Waterbodies/WaterBodyDetails_GetWaterQualityData
Example for Lake Thonotosassa https://api.wateratlas.usf.edu/waterbodies/5383/WaterQuality?s=2

I'll take a stab, sometime in the next couple of weeks, at making this API be a little more user friendly (Query by WBID/county & return a little more detail such as Run numbers etc.)

from tbeptools.

mikewessel avatar mikewessel commented on July 30, 2024

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

Revisiting this again, I think we're almost there: https://tbep-tech.github.io/tidalcreek-stats/Creek_select_tbeptools

Some final questions:

  • Is there a corresponding wbid and station file that is released with each IWR run? Run 62 is out now but I can't find a WBID 62 polygon shapefile. Same for stations, but these can be pulled from the .accdb files.
  • What is the importance of the newComment column? I couldn't find this in the imported data using the new workflow.
  • Are the files TidalCreek_ALL_Line.shp and TidalCreek_ALL_Line_Buff200m permanent? Guessing yes... if so, I will need to include the former in tbeptools, latter can be recreated with st_buffer w/ flat ends.
  • Long-term, how do we want to compare result between runs or as a time series? Ten-year moving windows?

from tbeptools.

mikewessel avatar mikewessel commented on July 30, 2024

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

Adding this here for the record, IWR spatial data are available here: https://geodata.dep.state.fl.us/, geojson download here: https://geodata.dep.state.fl.us/datasets/FDEP::impaired-waters-rule-iwr-stations/about

from tbeptools.

fawda123 avatar fawda123 commented on July 30, 2024

Finally closing this, too tedious to include a function in tbeptools for this. However, this external workfow seems to work well:
https://tbep-tech.github.io/tidalcreek-stats/Creek_select_tbeptools (updated for run 64 in this commit tbep-tech/tidalcreek-stats@6aae2fc).

from tbeptools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.