hw4 convert rinex nums
This commit is contained in:
5
hw4.Rmd
5
hw4.Rmd
@@ -36,7 +36,6 @@ rinex_file <- rstudioapi::selectFile()
|
|||||||
```
|
```
|
||||||
|
|
||||||
```{r read-file}
|
```{r read-file}
|
||||||
# Function to extract Klobuchar parameters from a RINEX navigation file
|
|
||||||
extract_klobuchar_parameters <- function(rinex_file) {
|
extract_klobuchar_parameters <- function(rinex_file) {
|
||||||
ion_alpha <- numeric(4)
|
ion_alpha <- numeric(4)
|
||||||
ion_beta <- numeric(4)
|
ion_beta <- numeric(4)
|
||||||
@@ -46,11 +45,11 @@ extract_klobuchar_parameters <- function(rinex_file) {
|
|||||||
while (length(line <- readLines(con, n = 1)) > 0) {
|
while (length(line <- readLines(con, n = 1)) > 0) {
|
||||||
if (grepl("ION ALPHA", line, fixed = TRUE)) {
|
if (grepl("ION ALPHA", line, fixed = TRUE)) {
|
||||||
# Extract the 4 numeric values from the line
|
# Extract the 4 numeric values from the line
|
||||||
ion_alpha <- unlist(strsplit(line, "\\s+"))[2:5]
|
ion_alpha <- as.numeric(gsub("D", "e", strsplit(line, "\\s+")[[1]][2:5]))
|
||||||
}
|
}
|
||||||
if (grepl("ION BETA", line, fixed = TRUE)) {
|
if (grepl("ION BETA", line, fixed = TRUE)) {
|
||||||
# Extract the 4 numeric values from the line
|
# Extract the 4 numeric values from the line
|
||||||
ion_beta <- unlist(strsplit(line, "\\s+"))[2:5]
|
ion_beta <- as.numeric(gsub("D", "e", strsplit(line, "\\s+")[[1]][2:5]))
|
||||||
}
|
}
|
||||||
# Stop reading if we've reached the end of the header (END OF HEADER)
|
# Stop reading if we've reached the end of the header (END OF HEADER)
|
||||||
if (grepl("END OF HEADER", line, fixed = TRUE)) {
|
if (grepl("END OF HEADER", line, fixed = TRUE)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user