pjbartlein / REarthSysSci

R for Earth-System Science
25 stars 19 forks source link

Inability to read the value I want #2

Open princess97 opened 4 years ago

princess97 commented 4 years ago

Hello, I have seen and tried your posts about opening netCDF file in R environment from your https://pjbartlein.github.io/REarthSysSci/netCDF.html page. I used the functions below. ncpath <- "C: \ Users \ xxxx \ Desktop / nc /"

ncname <- "ECMWF_ERA-40_subset" ncfname <- paste (ncpath, ncname, ".nc", sep = "") dname <- "hcc" ncin <- nc_open (ncfname) print (ncin) I just wanted to display the "hcc" variable. But it returned all variables in the file. Where do you think I went wrong and how can I solve it?

pjbartlein commented 4 years ago

Prenses, That’s what print(ncin) is supposed to do, provide information on all of the variables in a file, similar to the command-line ncdump.

Pat Bartlein

On 2020-10-05, at 02:05:03, prenses95 notifications@github.com wrote:

Hello, I have seen and tried your posts about opening netCDF file in R environment from your https://pjbartlein.github.io/REarthSysSci/netCDF.html page. I used the functions below. ncpath <- "C: \ Users \ xxxx \ Desktop / nc /"

ncname <- "ECMWF_ERA-40_subset" ncfname <- paste (ncpath, ncname, ".nc", sep = "") dname <- "hcc" ncin <- nc_open (ncfname) print (ncin) I just wanted to display the "hcc" variable. But it returned all variables in the file. Where do you think I went wrong and how can I solve it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

-- Prof. Patrick J. Bartlein Dept. Geography, Univ. Oregon; Eugene, OR 97403-1251 USA voice: +1 541 346 4967; www: https://pjbartlein.github.io/

princess97 commented 4 years ago

Thank you for the quick turnaround. So how am I going to see just the variable I want? Can you guide me?