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

error retrieving values from era-20c #12

Closed
zahachtah opened this issue Feb 1, 2021 · 5 comments
Closed

error retrieving values from era-20c #12

zahachtah opened this issue Feb 1, 2021 · 5 comments

Comments

@zahachtah
Copy link

If you have an idea how I would do this I'd appreciate it:

I have downloaded a dataset of 50 daily global t2m values. I can access the file just fine.

f = GribFile(filename)

works and

each m=Message(f) retrieves a new day's data.

m["longitudes"] gives me an array of longitudes data (length=88838)

however

m["values"] gives me:

ERROR: DimensionMismatch("new dimensions (2147483647, 256) must be consistent with array size 88838")
Stacktrace:
[1] (::Base.var"#throw_dmrsa#213")(::Tuple{Int64,Int64}, ::Int64) at ./reshapedarray.jl:41
[2] reshape at ./reshapedarray.jl:45 [inlined]
[3] reshape at ./reshapedarray.jl:116 [inlined]
[4] getindex(::Message, ::String) at /Users/jonnorberg/.julia/packages/GRIB/wj6Fn/src/message.jl:219
[5] top-level scope at REPL[41]:1

Would you know what I am doing wrong here?

Many thanks, Jon

@zahachtah
Copy link
Author

when I change (just a hack) line 219 of messages.jl to

return vals #reshape(vals, ni, nj)

I get the data with length 88838

@weech
Copy link
Owner

weech commented Feb 1, 2021

Hi,
Could you share the values of the "Ni" and "Nj" keys for this message? And also the value of the "gridDefinitionDescription" if it exists? I'm guessing the data you have has a variable number of rows per column, and I need to change line 212 to read if key == "values" && handle["Ni"] != (2^31 - 1) && handle["Nj"] != (2^31 - 1).

@zahachtah
Copy link
Author

julia> msg["gridDefinitionDescription"]
"Gaussian Latitude/Longitude Grid"

julia> msg["Nj"]
256

julia> msg["Ni"]
2147483647

julia> msg["totalLength"]
178296

Its a reduced gausian grid, but the number of values should be the same for each message iteration (iterates days)

@weech
Copy link
Owner

weech commented Feb 1, 2021

Are you using the latest version, 0.3.0? This appears to be a duplicate of #10, and the issue should have been fixed in that release.

@zahachtah
Copy link
Author

right. I had installed CfGrib.jl to test some day before and it downgrades Grib to 0.2.

sorry to take your time on this. works now

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

No branches or pull requests

2 participants