Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Data Archive #260

Closed
jonathancallahan opened this issue Feb 23, 2021 · 3 comments
Closed

Creating a Data Archive #260

jonathancallahan opened this issue Feb 23, 2021 · 3 comments
Assignees
Labels
documentation Function documentation

Comments

@jonathancallahan
Copy link
Member

jonathancallahan commented Feb 23, 2021

It is possible to create new 'pas' and 'pat' objects directly from the PurpleAir and ThingSpeak data sources. But this takes a long time.

For this article you will need to create a new archive for sensors in the Methow Valley. These sensors are seen with:

mvcca <- 
  pas_load() %>% 
  pas_filter(stringr::str_detect(label, "MV Clean Air Ambassador"))

pas_leaflet(mvcaa)

This document should go through the following steps:

flat directory structure

  • use setArchiveBaseUrl() to get initial 'pas' object only
  • get list of deviceDeploymentIDs for MVCAA sensors
  • in a for loop, use pat_createNew() create 'pat' objects for each sensor. I think it will get the last week if you don't specify startdate and enddate
  • save the created files all together in a single directory (i.e. ~/Data/my_project/)
  • load files with base load()

use the archive structure

Do the same but create monthly 'pat' files and store both the 'pas' and the 'pat' files in the "well known" archive directory structure.

  • create a directory with the "well known structure"
  • use setArchiveBaseDir() instead of setArchiveBaseUrl()
@jonathancallahan jonathancallahan added the documentation Function documentation label Feb 23, 2021
@jonathancallahan jonathancallahan added this to To do in documentation-improvements via automation Feb 23, 2021
@jeanmico
Copy link

Curious as to the archive directory structure - I pulled data from ~500 sensors and saved the data and meta for each as csv files (/project/deviceDeploymentID_data.csv, /project/deviceDeploymentID_meta.csv), and now can't figure out how to read them back in to a pa_timeseries object.

@jonathancallahan
Copy link
Member Author

@jeanmico By creating csv files you have basically left the world view of the AirSensor package. It isn't currently straightforward to reenter that world view and create pat_timeseries objects.

As you can see from this GitHub issue, we are working on some documentation to demonstrate how to create your own archive of 'pas' and 'pat' objects as compressed binary files -- ".rda" files.

After @AstridSanna finishes this document, we will be curious to get your feedback.

@jonathancallahan
Copy link
Member Author

@jeanmico We have just released a set of tutorials demonstrating how to create a local data archive:

https://working-with-data.mazamascience.com/2021/04/02/methow-valley-air-quality/

documentation-improvements automation moved this from To do to Done Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Function documentation
Development

No branches or pull requests

3 participants