Skip to content

Commit 5970390

Browse files
netCDF file updating added
1 parent 478a884 commit 5970390

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

vignettes/A_Make_data_grids.Rmd

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ options(tibble.print_min = 4L, tibble.print_max = 4L)
1616
```
1717

1818
```{r setup}
19-
library(AWAPer, warn.conflicts = FALSE)
19+
library(AWAPer)
2020
```
2121
This example shows how to build the required data file and then update it.
2222

@@ -48,13 +48,23 @@ ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdfFilename,
4848

4949
Now let's get a summary of the netCDF file that we've created. Note that the output data.frame shows the expected variables over the expected date range.
5050
```{r}
51-
summary.df <- AWAPer::summary(ncdffile.name)
51+
summary.df <- AWAPer::file.summary(ncdffile.name)
5252
summary.df
5353
```
54+
## Update an existing variable
55+
56+
Now that we've built the above file, the updating can be demonstrated. The BoM gridded data undergoes a detailed review and update process (see [https://www.bom.gov.au/climate/austmaps/about-rain-maps.shtml](here) and [https://www.bom.gov.au/climate/austmaps/update-schedule.shtml](here) ). Hence, the netCDF grids that one may have built some time ago may be require updating with revised BoM data.
57+
58+
The package allows for such updating between user defined dates. Here we'll update the data between the dates defined prior. Also, note that \code{vars} is not defined. This will cause all variables in the original file to be updated. That said, individual variables can be updated.
59+
60+
```{r}
61+
ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
62+
updateFrom=startDate, updateTo=endDate)
63+
```
5464

5565
## Add a variable to an existing data grids
5666

57-
Now that we've built the above file, the updating can be demonstrated. Here we'll update the data grids to also include vapour pressure. Here the same date range will be used. Because the date range of the new variable equals the date range of the existing variables, only vapour pressure data is updated. This feature can be used to update the data of a single variable as required.
67+
Here we'll update the data grids to also include vapour pressure. Here the same date range will be used. Because the date range of the new variable equals the date range of the existing variables, only vapour pressure data is updated. This feature can be used to update the data of a single variable as required.
5868

5969
```{r}
6070
ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
@@ -64,10 +74,10 @@ ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
6474

6575
Now let's check that the file includes both the original three variable plus vapour pressure.
6676
```{r}
67-
summary.df <- AWAPer::summary(ncdffile.name)
77+
summary.df <- AWAPer::file.summary(ncdffile.name)
6878
summary.df
6979
```
70-
## Add a variable to an existing data grids and update other variable
80+
## Add a variable to an existing data grids and update other variables
7181

7282
Now lets add solar radiation. Here an earlier start date will be used. However, because the date range of all variables within the netCDF file must be equal, the date range of the other variables must also be updated.
7383

@@ -81,8 +91,8 @@ ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
8191
vars = c('solarrad'))
8292
```
8393

84-
Now let's check that the file includes both the prior four three variable plus solar radiation.
94+
Now let's check that the file includes both the prior four variables plus solar radiation.
8595
```{r}
86-
summary.df <- AWAPer::summary(ncdffile.name)
96+
summary.df <- AWAPer::file.summary(ncdffile.name)
8797
summary.df
8898
```

vignettes/A_Make_data_grids.Rnw

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ options(tibble.print_min = 4L, tibble.print_max = 4L)
1616
```
1717
1818
```{r setup}
19-
library(AWAPer, warn.conflicts = FALSE)
19+
library(AWAPer)
2020
```
2121
This example shows how to build the required data file and then update it.
2222
@@ -48,13 +48,23 @@ ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdfFilename,
4848
4949
Now let's get a summary of the netCDF file that we've created. Note that the output data.frame shows the expected variables over the expected date range.
5050
```{r}
51-
summary.df <- AWAPer::summary(ncdffile.name)
51+
summary.df <- AWAPer::file.summary(ncdffile.name)
5252
summary.df
5353
```
54+
## Update an existing variable
55+
56+
Now that we've built the above file, the updating can be demonstrated. The BoM gridded data undergoes a detailed review and update process (see [https://www.bom.gov.au/climate/austmaps/about-rain-maps.shtml](here) and [https://www.bom.gov.au/climate/austmaps/update-schedule.shtml](here) ). Hence, the netCDF grids that one may have built some time ago may be require updating with revised BoM data.
57+
58+
The package allows for such updating between user defined dates. Here we'll update the data between the dates defined prior. Also, note that \code{vars} is not defined. This will cause all variables in the original file to be updated. That said, individual variables can be updated.
59+
60+
```{r}
61+
ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
62+
updateFrom=startDate, updateTo=endDate)
63+
```
5464
5565
## Add a variable to an existing data grids
5666
57-
Now that we've built the above file, the updating can be demonstrated. Here we'll update the data grids to also include vapour pressure. Here the same date range will be used. Because the date range of the new variable equals the date range of the existing variables, only vapour pressure data is updated. This feature can be used to update the data of a single variable as required.
67+
Here we'll update the data grids to also include vapour pressure. Here the same date range will be used. Because the date range of the new variable equals the date range of the existing variables, only vapour pressure data is updated. This feature can be used to update the data of a single variable as required.
5868
5969
```{r}
6070
ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
@@ -64,10 +74,10 @@ ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
6474
6575
Now let's check that the file includes both the original three variable plus vapour pressure.
6676
```{r}
67-
summary.df <- AWAPer::summary(ncdffile.name)
77+
summary.df <- AWAPer::file.summary(ncdffile.name)
6878
summary.df
6979
```
70-
## Add a variable to an existing data grids and update other variable
80+
## Add a variable to an existing data grids and update other variables
7181
7282
Now lets add solar radiation. Here an earlier start date will be used. However, because the date range of all variables within the netCDF file must be equal, the date range of the other variables must also be updated.
7383
@@ -81,8 +91,8 @@ ncdffile.name <- makeNetCDF_file(ncdfFilename=ncdffile.name,
8191
vars = c('solarrad'))
8292
```
8393
84-
Now let's check that the file includes both the prior four three variable plus solar radiation.
94+
Now let's check that the file includes both the prior four variables plus solar radiation.
8595
```{r}
86-
summary.df <- AWAPer::summary(ncdffile.name)
96+
summary.df <- AWAPer::file.summary(ncdffile.name)
8797
summary.df
8898
```

0 commit comments

Comments
 (0)