Closed JM-RG closed 5 years ago
@JM-RG I just ran the output below at home, so I have no advantage of being on our LAN or the like. Given that, I would suggest that you:
Make certain you have the latest version of 'rerddap' and 'rerddapXtracto' installed.
Print out the value of swchlInfo <- rerddap::info('erdSWchla8day') to make certain that this got info
If everything else looks okay, use the 'verbose' option in rxtracto().
> library(rerddapXtracto)
> tagData <- Marlintag38606
> xpos <- tagData$lon
> ypos <- tagData$lat
> tpos <- tagData$date
> zpos <- rep(0., length(xpos))
> swchlInfo <- rerddap::info('erdSWchla8day')
>
> swchlInfo
<ERDDAP info> erdSWchla8day
Base URL: https://upwell.pfeg.noaa.gov/erddap/
Dimensions (range):
time: (1997-09-02T00:00:00Z, 2010-12-07T00:00:00Z)
altitude: (0.0, 0.0)
latitude: (-90.0, 90.0)
longitude: (0.0, 360.0)
Variables:
chlorophyll:
Units: mg m-3
> swchl <- rxtracto(swchlInfo, parameter = 'chlorophyll', xcoord = xpos, ycoord = ypos, tcoord = tpos, zcoord = zpos, xlen = .2, ylen = .2)
Registered S3 methods overwritten by 'httr':
method from
as.character.form_file crul
print.cache_info hoardr
> str(swchl)
List of 13
$ mean chlorophyll : num [1:152] 0.073 NaN 0.074 0.0653 0.0403 ...
$ stdev chlorophyll : num [1:152] NA NA 0.00709 0.00768 0.02278 ...
$ n : int [1:152] 1 0 16 4 7 9 4 3 0 6 ...
$ satellite date : chr [1:152] "2003-04-19T00:00:00Z" "2003-04-27T00:00:00Z" "2003-04-27T00:00:00Z" "2003-04-27T00:00:00Z" ...
$ requested lon min : num [1:152] 204 204 204 204 204 ...
$ requested lon max : num [1:152] 204 204 204 204 204 ...
$ requested lat min : num [1:152] 19.6 19.7 20.3 20.2 20.2 ...
$ requested lat max : num [1:152] 19.8 19.9 20.5 20.4 20.4 ...
$ requested z min : num [1:152] 0 0 0 0 0 0 0 0 0 0 ...
$ requested z max : num [1:152] 0 0 0 0 0 0 0 0 0 0 ...
$ requested date : chr [1:152] "2003-04-23" "2003-04-24" "2003-04-30" "2003-05-01" ...
$ median chlorophyll: num [1:152] 0.073 NA 0.073 0.0645 0.031 ...
$ mad chlorophyll : num [1:152] 0 NA 0.00297 0.00741 0.0089 ...
- attr(*, "row.names")= chr [1:152] "1" "2" "3" "4" ...
- attr(*, "class")= chr [1:2] "list" "rxtractoTrack"
Thanks for replying Roy. I updated all the packages just to be sure, and now the code works well with the Marlin example, but doesn't with my own track. I checked it out and rerddap::info('erdMH1sstd8day')) succesfully retrieves information:
mylist <- list('varname:chl', 'datasetname:8day')
searchResult <- searchData(mylist)
DT::datatable(searchResult)
out <- rerddap::info('erdMH1chla8day')
out
One thing is you pass a zcoord value when the dataset does not have a 4th dimension (look at your own print out). Try removing the "zcoord = zpos" and see if the works. If not, please send me the entire script you are running and the first few lines of your dataset.
Now it works. I didn't notice this part of the vignette: "the zcoord has to be explicitly given, because ‘erdSWchla8day’ is a 4-D dataset (altitude is a dimension)." So with datasets I'm interested in, without a 4D, zpos is not needed.
Thank u again!
Hi Roy,
when just trying to reproduce the example provided:
tagData <- Marlintag38606 xpos <- tagData$lon ypos <- tagData$lat tpos <- tagData$date zpos <- rep(0., length(xpos)) swchlInfo <- rerddap::info('erdSWchla8day') swchl <- rxtracto(swchlInfo, parameter = 'chlorophyll', xcoord = xpos, ycoord = ypos, tcoord = tpos, zcoord = zpos, xlen = .2, ylen = .2)
I get the following error:
Error in if (substr(urlbase, lenURL, lenURL) != "/") { : argument is of length zero
Whit my own data, here summary(tagData) xpos <- tagData$Longitude ypos <- tagData$Latitude tpos <- tagData$Date zpos <- rep(0., length(xpos))
mylist <- list('varname:chla', 'datasetname:8day') searchResult <- searchData(mylist) DT::datatable(searchResult) outInfo <- rerddap::info('erdVH3chla8day') gps1chlR <- rxtracto(outInfo, parameter = 'chla', xcoord = xpos, ycoord = ypos, tcoord = tpos, zcoord = zpos, xlen = .2, ylen = .2)
I get this error: [1] "Requested coordinate names do no match dataset coordinate names" [1] "Requested coordinate names: longitude" "Requested coordinate names: latitude" [3] "Requested coordinate names: altitude" "Requested coordinate names: time"
[1] "Dataset coordinate names: time" "Dataset coordinate names: latitude" [3] "Dataset coordinate names: longitude" Error: Execution halted
Any idea?
I would like to use the package but got stucked just at the start :/
Thanks in advance
JM