[R-sig-Geo] getting data from an nc file

Kapo Coulibaly kmcou||b @end|ng |rom gm@||@com
Fri Jan 13 16:36:19 CET 2023


Hey Alexander,

I can look into it for you but your links didn't work for me. One is broken
and the other leads to a page where logging is required. If you can share
an example file I would see if I can help.

On Fri, Jan 6, 2023 at 9:03 AM Alexander Ilich <ailich using usf.edu> wrote:

> HDF Viewer<https://www.hdfgroup.org/downloads/hdfview/> can be a good way
> to look at the structure of nc files to see where different information is
> stored in the file.
> ________________________________
> From: R-sig-Geo <r-sig-geo-bounces using r-project.org> on behalf of Nick Wray <
> nickmwray using gmail.com>
> Sent: Wednesday, November 9, 2022 5:53 AM
> To: r-sig-geo using r-project.org <r-sig-geo using r-project.org>
> Subject: [R-sig-Geo] getting data from an nc file
>
> Hello
>
> I am trying to get rainfall data from the UK chess-met site
>
>
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcatalogue.ceh.ac.uk%2Fdatastore%2Feidchub%2F2ab15bf0-ad08-415c-ba64-831168be7293%2Fprecip%2F&data=05%7C01%7Cailich%40usf.edu%7C39cfc2a140934dc323d408dac240b9c0%7C741bf7dee2e546df8d6782607df9deaa%7C0%7C0%7C638060296454914830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AJ5Q%2BWYYGxbXJZjHxisFdGAAomjtIWn95k5r9vtXniw%3D&reserved=0
>
> and here there are a large number of nc files eg
>
> "chess-met_precip_gb_1km_daily_20150101-20150131.nc"
>
> I’ve found various sources on the net for opening nc files, and getting the
> data but when I try instructions like
>
> nc_data<-nc_open("chess-met_precip_gb_1km_daily_20150101-20150131.nc")
>
> lon <- ncvar_get(nc_data, "lon")
>
> lon
>
>
>
> the code works but all I get is a series of element numbers and no data:
>
> [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
>  [,9]
> [,10]    [,11]    [,12]
>
>           [,13]    [,14]    [,15]    [,16]    [,17]    [,18]    [,19]
> [,20]    [,21]    [,22]    [,23]    [,24]
>
>
>
> And similarly for latitude
>
> But if I open the nc file as a raster I get a raster precipitation plot of
> Great Britain, which rather suggests that the lat and long values are in
> there somewhere
>
> Can anyone help with getting the actual data sets out of an nc file?
>
> Thanks Nick Wray
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
>
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-geo&data=05%7C01%7Cailich%40usf.edu%7C39cfc2a140934dc323d408dac240b9c0%7C741bf7dee2e546df8d6782607df9deaa%7C0%7C0%7C638060296454914830%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dOzJYz06Zy8XUTh05KFvBI%2BMF3n0clxcgCsILupkkps%3D&reserved=0
> [EXTERNAL EMAIL] DO NOT CLICK links or attachments unless you recognize
> the sender and know the content is safe.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list