I have some grib files that I converted to csv. I would like to view the data in a table using the lat, lon, and variable as column headers. How can I do this using the grid data/dimensions within the file? In other words, I don't know how to assign each data point(var1) it's corresponding lat/lon point. Right now I have a Excel table full of data with 1441 rows/2880 columns.
dimensions:
lon = 2880;
lat = 1441;
time = 1;
variables:
int LatLon_Projection;
:grid_mapping_name = "latitude_longitude";
:earth_radius = 6367470.0; // double
float lat(lat=1441);
:units = "degrees_north";
float lon(lon=2880);
:units = "degrees_east";
float var1(time=1, lat=1441, lon=2880);
:long_name = "variable1";
:units = "";
:missing_value = NaNf; // float
:grid_mapping = "LatLon_Projection";
:coordinates = "reftime time lat lon ";
:Grib_Variable_Id = "var1";
:Grib2_Parameter = 0, 20, 132; // int
Best Answer
you might be able to skip the part where you make a csv, by using gdal_translate (part of GDAL/OGR) which supports GRIB files and ASCII XYZ
I don't have any GRIB files to test this on, but something like this should work and give you an XYZ file (3 columns, space as separator). The Z will be the value from the corresponding cell.
Example output...