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, &c GRIB file by the European Centre for Medium-Range Weather Forecasts and actively maintained, with an example page showing how to do it, sounds like a good approach.
One of the major things about R is that from the very beginnings of S it was intended to be used with other tools. We have R communicating with Python and Tcl and dear knows what. Getting a specialised tool to do its thing is very much part of the R "way". Or there's gribr https://rdrr.io/github/nawendt/gribr/man/gribr.html which wraps ecCodes in R. I still don't understand what "doesn't work" means. Which step goes wrong and how does it misbehave? On Wed, 26 Jun 2024 at 06:02, javad bayat <j.bayat...@gmail.com> wrote: > > 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 send it by email. > The file has 6 met parameters and Date (day/month/year hour:minute). > I want the exported file as excel contains 7 columns (Date + 6 met > parameters). > > > On Tue, 25 Jun 2024, 15:54 Richard O'Keefe, <rao...@gmail.com> wrote: >> >> 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", what actually happened? Which step went wrong and how? >> >> >> On Tue, 25 Jun 2024 at 20:33, javad bayat <j.bayat...@gmail.com> wrote: >> > >> > 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. >> > I am trying to convert it to an excel file that puts every parameter in a >> > separated column. For instance, the first col represents Date, 2nd >> > represents Temperature and so on. >> > Is there any way to do it? >> > I used these codes but did not work: >> > # install.packages("rNOMADS") >> > >> > library(rNOMADS) >> > >> > # Read GRIB data >> > grib_data <- ReadGrib("C:/Users/admin/Downloads/Met.grib") >> > >> > # Convert to a data frame >> > grib_df <- as.data.frame(grib_data) >> > >> > # Write the data frame to a CSV file >> > write.csv(grib_df, file = "output.csv") >> > >> > >> > I would be more than happy if anyone could help me. >> > Sincerely >> > >> > -- >> > Best Regards >> > Javad Bayat >> > M.Sc. Environment Engineering >> > Alternative Mail: bayat...@yahoo.com >> > ______________________________________________ >> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> > http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.