Re: [R] Converting .grib to excel file

2024-06-28 Thread javad bayat
Dear Richard, I could not extract the data at all. But what I found is that, the data stored in the grib file converted into raster layer, and as I had 6 met parameters for a complete year (6 × 365 × 24) the raster layer has 52,560 layer. The first layer belongs to the first parameter for the

Re: [R] Converting .grib to excel file

2024-06-26 Thread Richard O'Keefe
Whoops, sorry, you *did* answer "what went wrong". > param_names <- c("param1", "param2", "param3", "param4", "param5", "param6") > extracted_data <- extract(raster_data, param_names, df = TRUE) #Error in (function (classes, fdef, mtable) : #unable to find an inherited method for function

Re: [R] Converting .grib to excel file

2024-06-26 Thread Richard O'Keefe
I'm now inclined to go with 'search for "convert GRIB to CSV". https://confluence.ecmwf.int/display/CKB/How+to+convert+GRIB+to+CSV is the first line. I know that's not an R solution, but using software specifically developed for encoding, decoding, extracting, GRIB file by the European Centre

Re: [R] Converting .grib to excel file

2024-06-26 Thread javad bayat
Dear all; I used the terra package to export .grib data as an excel file but I could not do it. The grib file is readed and converted to raster correctly. It contains hourly data of a complete year for 6 met parameters (365 * 24 * 6 = 52,560). In the "raster_data" it can be seen as "nlyr" (

Re: [R] Converting .grib to excel file

2024-06-25 Thread javad bayat
Dear Bert and Sara; I have searched on the internet and found some way to do this like python. But python is so complicated to me as it needs many steps to be done for reading and converting it. I will try terra package to convert it. On Tue, 25 Jun 2024, 15:15 javad bayat, wrote: > Richard, >

Re: [R] Converting .grib to excel file

2024-06-25 Thread javad bayat
Richard, Many thanks for your email. I had attached the grib file to the original email to R help team but it seems you did not receive it. Unfortunately, I do not know how to reduce the volume or extract some of the grib file data to send it for you. The file has the volume of 6 Megabyte. I can

Re: [R] Converting .grib to excel file

2024-06-25 Thread Sarah Goslee
Hi, While Bert is correct that there are plenty of tools, my preferred approach is to use the terra package to load a grib as a raster stack. >From there, it's straightforward to use all the spatial tools with the data, or to extract it in whatever form and with whatever dimensions you wish.

Re: [R] Converting .grib to excel file

2024-06-25 Thread Bert Gunter
Do a web search on "convert grib data to csv". You will get many hits. You probably don't need R to do this. -- Bert On Tue, Jun 25, 2024 at 1:33 AM javad bayat wrote: > Dear all; > I have downloaded meteorology data from " > >

Re: [R] Converting .grib to excel file

2024-06-25 Thread Richard O'Keefe
Your message referred to an attached file but there was no attachment, I have no account at that service, so could not download a sample for myself. Does the licence for the data even allow you to send some of it in a message? Which parameters are you extracting? When you say "it didn't work",

[R] Converting .grib to excel file

2024-06-25 Thread javad bayat
Dear all; I have downloaded meteorology data from " https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels?tab=form; as .grib format. It has hourly data of a complete year (every hour of every day of 12 months) and has 6 meteorology parameters. The file has been attached.