-
Notifications
You must be signed in to change notification settings - Fork 5
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
41 new feature read csv datasets #76
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #76 +/- ##
==========================================
+ Coverage 72.38% 73.86% +1.47%
==========================================
Files 8 8
Lines 1492 1584 +92
==========================================
+ Hits 1080 1170 +90
- Misses 412 414 +2 ☔ View full report in Codecov by Sentry. |
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.
- Please add tests.
- Please add examples in the documentation of the function
How would you like to add a example ? We need either a example of csv file (like the one we in netcdf) or something else I do not know ... Any suggestions ? Same for the tests, we need a csv file to test ... |
It can be good idea to have the same sample dataset that we already have in netcdf, in csv format. This could allow testing the csv functions, but also testing that we have same results, no matter the format of the dataset. |
Can you add it in the code (internal-data.R ?) like you did for the ncdf |
Done with 0f7a178 (in |
I added an example in the function, + several new and missing tests |
Co-authored-by: Thomas Arsouze <[email protected]>
Co-authored-by: Thomas Arsouze <[email protected]>
pressure = "usa_pres", | ||
poci = "usa_poci" | ||
) | ||
SP_2015_2020_csv <- defStormsDataset(fields = fields, seasons = c(2015, 2020)) |
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.
SP_2015_2020_csv <- defStormsDataset(fields = fields, seasons = c(2015, 2020)) | |
SP_2015_2020_csv <- defStormsDataset(system.file("extdata", "test_dataset.csv", package = "StormR"), fields = fields, seasons = c(2015, 2020)) |
Hereafter, an example where we access the data with `test_dataset.csv`. | ||
Notice that the header of the csv and the names of columns in `fields` input must be equals | ||
```{r chunk 4} | ||
# Header of the csv | ||
head(read.csv(system.file("extdata", "test_dataset.csv", package = "StormR"))) | ||
``` | ||
|
||
|
||
```{r chunk 5} | ||
# Is already the default setting (in this particular case) | ||
fields <- c( | ||
names = "name", | ||
seasons = "season", | ||
isoTime = "iso_time", | ||
lon = "usa_lon", | ||
lat = "usa_lat", | ||
msw = "usa_wind", | ||
sshs = "usa_sshs", | ||
rmw = "usa_rmw", | ||
pressure = "usa_pres", | ||
poci = "usa_poci" | ||
) |
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.
Hereafter, an example where we access the data with `test_dataset.csv`. | |
Notice that the header of the csv and the names of columns in `fields` input must be equals | |
```{r chunk 4} | |
# Header of the csv | |
head(read.csv(system.file("extdata", "test_dataset.csv", package = "StormR"))) | |
``` | |
```{r chunk 5} | |
# Is already the default setting (in this particular case) | |
fields <- c( | |
names = "name", | |
seasons = "season", | |
isoTime = "iso_time", | |
lon = "usa_lon", | |
lat = "usa_lat", | |
msw = "usa_wind", | |
sshs = "usa_sshs", | |
rmw = "usa_rmw", | |
pressure = "usa_pres", | |
poci = "usa_poci" | |
) | |
Hereafter, you can see the header of the dataset sample `test_dataset.csv` embbeded in the package. | |
Notice that the first line of the file must contain the names of columns and correspond to the `fields` input. | |
```{r chunk 4} | |
# Header of the csv | |
head(read.csv(system.file("extdata", "test_dataset.csv", package = "StormR"))) |
You can then define de stormsDataset
object as follows:
# Is already the default setting (in this particular case)
fields <- c(
names = "name",
seasons = "season",
isoTime = "iso_time",
lon = "usa_lon",
lat = "usa_lat",
msw = "usa_wind",
sshs = "usa_sshs",
rmw = "usa_rmw",
pressure = "usa_pres",
poci = "usa_poci"
)
Keypoints for this pull request:
defStormsDataset()
into 2 subroutines depending on the extension offilename
:getDataFromNcdfFile()
andgetDataFromNcdfFile()
poci
inputHere is a reproducible code for the test: