ropensci / rerddap

R client for working with ERDDAP servers
https://docs.ropensci.org/rerddap
Other
40 stars 14 forks source link

Bug in `griddap()` #71

Closed sckott closed 6 years ago

sckott commented 6 years ago
library(rerddap)
x=griddap("NOAA_DHW_5km",
           time=c("2017-12-30T00:00:00Z", "2017-12-31T00:00:00Z"),
           latitude=c(18,19),
           longitude=c(-161,160),
           url = "http://oos.soest.hawaii.edu/erddap/",
           fmt = "csv",
           read = TRUE)
# Error: HTTP Status 500 - Query error: For variable=CRW_DHW axis#1=latitude Constraint="[(18):1:(19)]": StartIndex=1440 is greater than StopIndex=1420.

y=griddap(aa,
            time=c("2017-12-30T00:00:00Z", "2017-12-31T00:00:00Z"),
            latitude=c(19,18),
            longitude=c(-161,160),
            url = "http://oos.soest.hawaii.edu/erddap/",
            fmt = "csv",
            read = TRUE)
# Error: HTTP Status 500 - Query error: For variable=CRW_DHW axis#1=latitude Constraint="[(18):1:(19)]": StartIndex=1440 is greater than StopIndex=1420.
sckott commented 6 years ago

the /info ERDDAP request is returning the wrong information.

e.g. https://upwell.pfeg.noaa.gov/erddap/info/noaa_esrl_d7ee_ffb3_d5a0/index.json

is returning for latitude

["attribute", "latitude", "actual_range", "float", "-89.75, 89.75"],

which is in the opposite order from what the web interface has https://upwell.pfeg.noaa.gov/erddap/griddap/noaa_esrl_d7ee_ffb3_d5a0.html

screen shot 2018-03-29 at 2 13 33 pm

we definitely depend on the order of the min and max of lat and long to be in the same order that the ERDDAP server expects, so AFAICT we're at a dead end here unless maybe the ERDDAP /info request is returning the wrong data, and it can be fixed?

thoughts @rmendels ?

rmendels commented 6 years ago

Hi Scott:

This is exactly what I reported to you in issue #68, and warned you that you needed to change. The reason for this is the CF standard now says that the metadata for the range should have the lowest first and the highest second, regardless of the ordering in the file. The solution, as I reported in Issue #68, is to use the latitude_spacing. I even gave sample (but kludgy) code, based on what is already contained in a call to rerddap::info().

I have already changed this in rerddapXtracto, so that I change the latitudes myself based on spacing, and it goes through rerddap.

-Roy

sckott commented 6 years ago

should be fixed in #68