-
Notifications
You must be signed in to change notification settings - Fork 14
adding processing scripts for ticket #19667 Russell #12
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
Open
angelchen7
wants to merge
3
commits into
NCEAS:master
Choose a base branch
from
angelchen7:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #ticket #19667: https://arcticdata.io/catalog/view/urn:uuid:6a64c7ad-aa08-424a-9cf9-8a5747436813 | ||
| #formatted like this https://www-air.larc.nasa.gov/missions/etc/IcarttDataFormat.htm | ||
| #spending time to do https://learning.nceas.ucsb.edu/2020-02-RRCourse/data-cleaning-and-manipulation.html | ||
|
|
||
| #making attributes for Barrow_Spectra_Barrow_20080302_R1_thru20100305.ict | ||
| #grab the names of the columns using names() and make that a data frame (using data.frame() | ||
| #split the names into wavelength and frame number columns using separate() | ||
| #create descriptions of the attributes using a combination of mutate() and paste(), descriptions can match a format like "absorbance at x nm, frame y" | ||
| #add units, etc using mutate (unit can be dimensionless | ||
|
|
||
| #1878 total variables | ||
|
|
||
|
|
||
| pkg <- get_package(adc, 'resource_map_urn:uuid:6b36ffd1-98f3-415d-a1b7-822a67745a1b', file_names = TRUE) | ||
| doc <- read_eml(getObject(adc, pkg$metadata)) | ||
|
|
||
| dat <- read.csv("~/ticket #19667 Russell/Barrow_Spectra_Barrow_20080302_R1_thru20100305.ict", skip = 1906) | ||
|
|
||
| names_df <- data.frame(names(dat)) | ||
| names_vector <- as.vector(names_df[[1]]) | ||
|
|
||
| descriptions1 <- c("number of seconds elapsed since 03/02/2008 in Coordinated Universal Time (UTC), recorded when a day began", "number of seconds elapsed since 03/02/2008 in Coordinated Universal Time (UTC), recorded when a day ended") | ||
|
|
||
| wavenumbers <- seq(400, 4000, by=1.92) | ||
| descriptions2 <- paste("absorbance at wavenumber", wavenumbers) | ||
|
|
||
| scales1 <- c("ratio", "ratio") | ||
| scales2 <- rep("ratio", 1876) | ||
|
|
||
| domains <- rep("numericDomain", 1878) | ||
|
|
||
| format_strings <- rep(NA, 1878) | ||
|
|
||
| definitions <- rep(NA, 1878) | ||
|
|
||
| units1 <- c("second", "second") | ||
| units2 <- rep("dimensionless" ,1876) | ||
|
|
||
| number_types <- rep("real", 1878) | ||
|
|
||
| missing_codes <- rep(NA, 1878) | ||
| missing_explanations <- rep(NA, 1878) | ||
|
|
||
| attributes <- data.frame( | ||
| attributeName = names_vector, | ||
| attributeDefinition = c(descriptions1, descriptions2), | ||
| measurementScale = c(scales1, scales2), | ||
| domain = domains, | ||
| formatString = format_strings, | ||
| definition = definitions, | ||
| unit = c(units1, units2), | ||
| numberType = number_types, | ||
| missingValueCode = missing_codes, | ||
| missingValueCodeExplanation = missing_explanations, | ||
|
|
||
| stringsAsFactors = FALSE) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works since you know what the step is for the wavenumbers (and it is an equal step across all the data), but the way I would have done this would leverage the values already in the columns. See suggestion below which leverages the dplyr functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can then use that to build the rest of your attributes, and stick on the top two using
rbindor add them inshiny_attributes