Skip to content
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

loadSeasonalForecast says "Error in rt.axis$getCalendarDates() : attempt to apply non-function" #54

Open
ottohyva opened this issue Mar 25, 2019 · 3 comments

Comments

@ottohyva
Copy link

Hi,

I have loaded a grib file from MARS with this
"""
from ecmwfapi import ECMWFService

filename = "myforecastT2mAnomGlobal.grib"

server = ECMWFService("mars")
server.execute({
"class": "od",
"date": "2019-02-01",
"expver": 1,
"fcmonth": [1, 2, 3, 4, 5, 6, 7],
"levtype": "sfc",
"method": 1,
"number": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50],
"origin": "ecmf",
"param": "167.171",
"stream": "mmsa",
"system": 5,
"time": "00:00:00",
"type": "fcmean"
}
,
filename
)
"""
and then try to load it with

library(loadeR)
di=dataInventory("others/myforecastT2mAnomGlobal.grib")
[2019-03-25 16:11:33] Doing inventory ...
[2019-03-25 16:11:33] Retrieving info for '2_metre_temperature_anomaly_surface' (0 vars remaining)
[2019-03-25 16:11:33] Done.
str(di)
List of 1
$ 2_metre_temperature_anomaly_surface:List of 4
..$ Description: chr "2 metre temperature anomaly @ Ground or water surface"
..$ DataType : chr "float"
..$ Units : chr "K"
..$ Dimensions :List of 3
.. ..$ time:List of 4
.. .. ..$ Type : chr "Time"
.. .. ..$ TimeStep : chr "736.0 Hour"
.. .. ..$ Units : chr "Hour since 2019-02-01T00:00:00Z"
.. .. ..$ Date_range: chr "2019-03-01T00:00:00Z - 2019-09-01T00:00:00Z"
.. ..$ lat :List of 3
.. .. ..$ Type : chr "Lat"
.. .. ..$ Units : chr "degrees_north"
.. .. ..$ Values: num [1:640] 89.8 89.5 89.2 88.9 88.7 ...
.. ..$ lon :List of 3
.. .. ..$ Type : chr "Lon"
.. .. ..$ Units : chr "degrees_east"
.. .. ..$ Values: num [1:1296] 0 0.278 0.556 0.833 1.111 ...
a=loadSeasonalForecast("others/myforecastT2mAnomGlobal.grib", var="2_metre_temperature_anomaly_surface",season=5)
[2019-03-25 16:11:38] Opening dataset...
[2019-03-25 16:11:38] The dataset was successfuly opened
[2019-03-25 16:11:38] Defining geo-location parameters
[2019-03-25 16:11:38] Defining initialization time parameters
Error in rt.axis$getCalendarDates() : attempt to apply non-function

I understand that you prefer us to use loadeR.ECOMS, but we would like to use local files.

@ottohyva
Copy link
Author

This error is caused by line 9 in the function loadeR:::getRunTimeDomain.seasonal:
rt.axis <- gcs$getRunTimeAxis()
because the file apparently does not contain the RunTime axis. Ah, I have to do something to my files?

@jbedia
Copy link
Member

jbedia commented Mar 27, 2019

Dera @ottohyva , thanks for your ticket. The file has no definition for the runtime axis, and therefore this dimension is not found. Please try to use loadGridData instead. Best regards

@ottohyva
Copy link
Author

Thanks, I still have to change attributes with "ncatted -a _CoordinateAxisType,number,o,c,Ensemble foo.nc", because otherwise loadGridData thinks ensemble members are levels. Then I thought I can fix RunTime with "ncatted -a _CoordinateAxisType,time,o,c,RunTime foo.nc", but that breaks things: "NOTE: Undefined Dataset Time Axis (static variable)", so I am not going to do that.

If I load seasonal (re)forecasts with loadGridData, will there be problems later, or is loadSeasonalForecast just a more convenient version of loadGridData?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants