first commit
This commit is contained in:
59
HD_ns53.R
Normal file
59
HD_ns53.R
Normal file
@@ -0,0 +1,59 @@
|
||||
# NS53 Satellite Data
|
||||
# Michael D Cayton
|
||||
# March 9, 2019
|
||||
# Last update 3-19-19
|
||||
|
||||
|
||||
#### Load the libraries ###
|
||||
library(tidyverse)
|
||||
|
||||
ns53_130331_v1.03 <- read_delim('ftp://ftp.ngdc.noaa.gov/STP/space-weather/satellite-data/satellite-systems/gps/data/ns53/ns53_130331_v1.03.ascii'
|
||||
, comment ='#'
|
||||
, delim=' '
|
||||
, col_names = FALSE
|
||||
, trim_ws = TRUE)
|
||||
|
||||
ns53_130331_v1.03 <- tbl_df(ns53_130331_v1.03)
|
||||
ns53_130331_v1.03
|
||||
|
||||
ns53_HD <- ns53_130331_v1.03 %>% select(3:41)
|
||||
ns53_HD <- tbl_df(ns53_HD)
|
||||
ns53_HD
|
||||
|
||||
## Uncomment if you need to write file
|
||||
# write_csv(ns53_HD, path='Happy Dad/ns53_130331_hd.csv', col_names = FALSE)
|
||||
|
||||
# write data matrix to a fixed width format for FORTRAN.
|
||||
|
||||
ns53_test <- sprintf("%.6f", ns53_HD$X3)
|
||||
ns53_test <- tbl_df(ns53_test)
|
||||
|
||||
ns53_test <- cbind(ns53_test, sapply(ns53_HD[2:4], sprintf, fmt = "%.3f"))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sapply(ns53_HD[5:20], sprintf, fmt = "%.3e"))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sprintf("%1i", ns53_HD$X23))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sprintf("%3i", ns53_HD$X24))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sprintf("%4i", ns53_HD$X25))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sprintf("%4.8f", ns53_HD$X26))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sprintf("%2i", ns53_HD$X27))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sprintf("%1i", ns53_HD$X28))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sapply(ns53_HD[27:37], sprintf, fmt = "%.4f"))
|
||||
|
||||
ns53_test <- cbind(ns53_test, sapply(ns53_HD[38:39], sprintf, fmt = "%.3e"))
|
||||
|
||||
write.table(ns53_test, file='Happy Dad/ns53_test.txt', col.names=FALSE, row.names=FALSE, sep=" ", quote=FALSE)
|
||||
|
||||
# possible fixed width format
|
||||
sprintf("%+010.6f", ns53_HD$X4)
|
||||
|
||||
# Possibly to do the FORTRAN evaluations in R.
|
||||
eigen(cor(ns53_test))
|
||||
cor(ns53_test)
|
||||
|
||||
Reference in New Issue
Block a user