Comments (6)
Hi,
Thank you for pointing out this issue. To answer the question, GRIB.jl does support the part of the ecCodes that returns the closest grid point values to a given geolocation. The relevant functions are in the nearest.jl file. I recommend using the findmultiple
function, but the Nearest
interface is also available.
I'm not happy with how the package is handling the reduced Gaussian grid. I haven't seen one of those in the wild before; would you mind sending one message from the file or linking to where you got the file? I'd like to create a consistent interface or provide better error messages, if possible.
from grib.jl.
Thanks a lot for your quick response.
I have placed a message using reduced Gaussian grid here ftp://ftp.eumetsat.int/pub/EUM/out/RSP/Hultberg/rgg
Indeed findmultiple seems to fit perfectly my needs. Also it seems that it does not take the longitude into account for reduced Gaussian grid data
julia> findmultiple(msg, [20.5], [44.4])
([179.86196319018404], [44.4639708083398], [0.0], [9919.87420565357])
Cheers, Tim
from grib.jl.
I fixed it so that any grid that has a missing value for Ni returns "values" as a 1D array instead of trying to reshape it into a 2D array. Thanks again for reporting the bug!
from grib.jl.
Thanks. I confirm that msg["values"] is now working with RGG. But findmultiple is still not taking the longitude into account
from grib.jl.
Even when I just try "find", I get points close to the correct latitude (22.2) but not the longitude (44.4). But looking at your code it seems that you do nothing besides calling eccodes, which makes it likely that this bug is coming from eccodes itself. Strange!
julia> Nearest(msg) do near
lons, lats, values, distances = find(near, msg, 44.4, 22.2)
end
([179.81404958677683, 179.8142414860681, 180.0, 180.0], [22.24956018578469, 22.179261417577013, 22.24956018578469, 22.179261417577013], [0.0, 0.0, 0.0, 0.0], [13097.650649938698, 13102.960217681357, 13111.69601894782, 13117.004309755657])
from grib.jl.
As a sanity check, I tried it in C to make sure I didn't get longitudes and latitudes mixed up at some point. I agree, it's an ecCodes bug.
This:
#include <stdio.h>
#include <eccodes.h>
void array_print(double* arr, int len) {
printf("[");
for (int i = 0; i < len; i++) {
printf("%f, ", arr[i]);
}
printf("]\n");
}
int main() {
FILE* f = fopen("/home/alex/data/t_137_msg", "r");
int err;
grib_handle* msg = codes_grib_handle_new_from_file(NULL, f, &err);
grib_nearest* nearest = codes_grib_nearest_new(msg, &err);
double outlats[4;
double outlons[4];
double values[4];
double distances[4];
int indexes[4];
size_t len = 4;
err = codes_grib_nearest_find(nearest, msg, 22.2, 44.4, CODES_NEAREST_SAME_POINT | CODES_NEAREST_SAME_GRID,
outlats, outlons, values, distances, indexes, &len);
printf("Latitudes: ");
array_print(outlats, len);
printf("Longitudes: ");
array_print(outlons, len);
printf("Distances: ");
array_print(distances, len);
return 0;
}
Produces
Latitudes: [22.179261, 22.179261, 22.249560, 22.249560, ]
Longitudes: [180.000000, 179.814241, 180.000000, 179.814050, ]
Distances: [13124.747859, 13110.695476, 13119.436435, 13105.382774, ]
from grib.jl.
Related Issues (13)
- Array Interface? HOT 3
- TagBot trigger issue HOT 2
- error retrieving values from era-20c HOT 5
- Define Custom Exception Type
- Support for Windows HOT 22
- Register :) HOT 14
- Co-operation on high-level GRIB interface HOT 2
- Missing message names from HRRR GRIB2 file. HOT 3
- Create definition files for NCEP local codes HOT 1
- Key not found when parsing a message HOT 4
- Thread safety HOT 2
- Fix hour field for ERA5-Land hourly data HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grib.jl.