0

I am new to working with large geospatial data in R. I downloaded daily ice data from EarthData for a certain spatiotemporal period, giving me a .txt file with ~15,000 rows where each row is a daily (or monthly) .nc file. It looks like this:

https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.01/NSIDC0051_SEAICE_PS_N25km_198001_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.01/NSIDC0051_SEAICE_PS_N25km_19800101_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.02/NSIDC0051_SEAICE_PS_N25km_19800102_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.03/NSIDC0051_SEAICE_PS_N25km_19800103_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.04/NSIDC0051_SEAICE_PS_N25km_19800104_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.05/NSIDC0051_SEAICE_PS_N25km_19800105_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.06/NSIDC0051_SEAICE_PS_N25km_19800106_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.07/NSIDC0051_SEAICE_PS_N25km_19800107_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.08/NSIDC0051_SEAICE_PS_N25km_19800108_v2.0.nc https://n5eil01u.ecs.nsidc.org/DP4/PM/NSIDC-0051.002/1980.01.09/NSIDC0051_SEAICE_PS_N25km_19800109_v2.0.nc ...

I read in the .txt file into R as a data frame.

I want to extract the attributes associated with each .nc file (do not need to plot the data). Each file is one day, although at the beginning of each month, there is a summary month .nc file that I want to exclude (in my example, the summary month .nc is the first file).

I have package ncdf4 installed. I'd really appreciate any help with accessing the attributes within the .nc files. This is wrong but here is what I started doing:

library(ncdf4) ice <- read.table('C:/path/file.txt',sep='\t')

for(i in 1:length(ice)) { nc_open[[i]] ncvar_get(i) }

Error in nc_open[[i]] : object of type 'closure' is not subsettable

Any help is appreciated, thank you!

burphound
  • 161
  • 7
  • 1
    These are password protected files that appear to only be downloadable. It’s probably better to download them using wget etc than using R – Robert Wilson Apr 08 '23 at 05:29

0 Answers0