Hi,
Yes this is the canadian domain data.
I want to extract only for parts of western Canada.
Further, this data has three variable namely pr, tmax and tmin. I am trying
to extract three different .nc files of each parameters for a smaller
domain.
below is the results of str(myfile).
str(ncold)
List of 12
$ filename : chr "ddf.nc"
$ writable : logi FALSE
$ id : int 65536
$ format : chr "NC_FORMAT_NETCDF4_CLASSIC"
$ is_GMT : logi FALSE
$ groups :List of 1
..$ :List of 7
.. ..$ id : int 65536
.. ..$ name : chr ""
.. ..$ ndims: int 3
.. ..$ nvars: int 6
.. ..$ natts: int 10
.. ..$ dimid: int [1:3(1d)] 0 1 2
.. ..$ fqgn : chr ""
.. ..- attr(*, "class")= chr "ncgroup4"
$ ndims : num 3
$ natts : num 10
$ dim :List of 3
..$ lon :List of 10
.. ..$ name : chr "lon"
.. ..$ len : int 1068
.. ..$ unlim : logi FALSE
.. ..$ group_index : int 1
.. ..$ group_id : int 65536
.. ..$ id : int 0
.. ..$ dimvarid :List of 5
.. .. ..$ id : int 0
.. .. ..$ group_index: int 1
.. .. ..$ group_id : int 65536
.. .. ..$ list_index : num -1
.. .. ..$ isdimvar : logi TRUE
.. .. ..- attr(*, "class")= chr "ncid4"
.. ..$ units : chr "degrees_east"
.. ..$ vals : num [1:1068(1d)] -141 -141 -141 -141 -141 ...
.. ..$ create_dimvar: logi TRUE
.. ..- attr(*, "class")= chr "ncdim4"
..$ lat :List of 10
.. ..$ name : chr "lat"
.. ..$ len : int 510
.. ..$ unlim : logi FALSE
.. ..$ group_index : int 1
.. ..$ group_id : int 65536
.. ..$ id : int 1
.. ..$ dimvarid :List of 5
.. .. ..$ id : int 1
.. .. ..$ group_index: int 1
.. .. ..$ group_id : int 65536
.. .. ..$ list_index : num -1
.. .. ..$ isdimvar : logi TRUE
.. .. ..- attr(*, "class")= chr "ncid4"
.. ..$ units : chr "degrees_north"
.. ..$ vals : num [1:510(1d)] 41 41.1 41.2 41.3 41.4 ...
.. ..$ create_dimvar: logi TRUE
.. ..- attr(*, "class")= chr "ncdim4"
..$ time:List of 11
.. ..$ name : chr "time"
.. ..$ len : int 22280
.. ..$ unlim : logi TRUE
.. ..$ group_index : int 1
.. ..$ group_id : int 65536
.. ..$ id : int 2
.. ..$ dimvarid :List of 5
.. .. ..$ id : int 2
.. .. ..$ group_index: int 1
.. .. ..$ group_id : int 65536
.. .. ..$ list_index : num -1
.. .. ..$ isdimvar : logi TRUE
.. .. ..- attr(*, "class")= chr "ncid4"
.. ..$ units : chr "days since 1950-01-01 00:00:00"
.. ..$ calendar : chr "standard"
.. ..$ vals : num [1:22280(1d)] 0 1 2 3 4 5 6 7 8 9 ...
.. ..$ create_dimvar: logi TRUE
.. ..- attr(*, "class")= chr "ncdim4"
$ unlimdimid: num 3
$ nvars : num 3
$ var :List of 3
..$ pr :List of 22
.. ..$ id :List of 5
.. .. ..$ id : num 3
.. .. ..$ group_index: num -1
.. .. ..$ group_id : int 65536
.. .. ..$ list_index : num 1
.. .. ..$ isdimvar : logi FALSE
.. .. ..- attr(*, "class")= chr "ncid4"
.. ..$ name : chr "pr"
.. ..$ ndims : int 3
.. ..$ natts : int 5
.. ..$ size : int [1:3] 1068 510 22280
.. ..$ dimids : int [1:3] 0 1 2
.. ..$ prec : chr "float"
.. ..$ units : chr "mm day-1"
.. ..$ longname : chr "Precipitation"
.. ..$ group_index : int 1
.. ..$ chunksizes : logi NA
.. ..$ storage : num 2
.. ..$ shuffle : logi FALSE
.. ..$ compression : logi NA
.. ..$ dims : list()
.. ..$ dim :List of 3
.. .. ..$ :List of 10
.. .. .. ..$ name : chr "lon"
.. .. .. ..$ len : int 1068
.. .. .. ..$ unlim : logi FALSE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 0
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 0
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "degrees_east"
.. .. .. ..$ vals : num [1:1068(1d)] -141 -141 -141 -141 -141 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. .. ..$ :List of 10
.. .. .. ..$ name : chr "lat"
.. .. .. ..$ len : int 510
.. .. .. ..$ unlim : logi FALSE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 1
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 1
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "degrees_north"
.. .. .. ..$ vals : num [1:510(1d)] 41 41.1 41.2 41.3 41.4 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. .. ..$ :List of 11
.. .. .. ..$ name : chr "time"
.. .. .. ..$ len : int 22280
.. .. .. ..$ unlim : logi TRUE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 2
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 2
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "days since 1950-01-01 00:00:00"
.. .. .. ..$ calendar : chr "standard"
.. .. .. ..$ vals : num [1:22280(1d)] 0 1 2 3 4 5 6 7 8 9 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. ..$ varsize : int [1:3] 1068 510 22280
.. ..$ unlim : logi TRUE
.. ..$ make_missing_value: logi TRUE
.. ..$ missval : num -32768
.. ..$ hasAddOffset : logi FALSE
.. ..$ hasScaleFact : logi FALSE
.. ..- attr(*, "class")= chr "ncvar4"
..$ tasmax:List of 22
.. ..$ id :List of 5
.. .. ..$ id : num 4
.. .. ..$ group_index: num -1
.. .. ..$ group_id : int 65536
.. .. ..$ list_index : num 2
.. .. ..$ isdimvar : logi FALSE
.. .. ..- attr(*, "class")= chr "ncid4"
.. ..$ name : chr "tasmax"
.. ..$ ndims : int 3
.. ..$ natts : int 5
.. ..$ size : int [1:3] 1068 510 22280
.. ..$ dimids : int [1:3] 0 1 2
.. ..$ prec : chr "float"
.. ..$ units : chr "degC"
.. ..$ longname : chr "Daily Maximum Near-Surface Air
Temperature"
.. ..$ group_index : int 1
.. ..$ chunksizes : logi NA
.. ..$ storage : num 2
.. ..$ shuffle : logi FALSE
.. ..$ compression : logi NA
.. ..$ dims : list()
.. ..$ dim :List of 3
.. .. ..$ :List of 10
.. .. .. ..$ name : chr "lon"
.. .. .. ..$ len : int 1068
.. .. .. ..$ unlim : logi FALSE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 0
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 0
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "degrees_east"
.. .. .. ..$ vals : num [1:1068(1d)] -141 -141 -141 -141 -141 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. .. ..$ :List of 10
.. .. .. ..$ name : chr "lat"
.. .. .. ..$ len : int 510
.. .. .. ..$ unlim : logi FALSE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 1
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 1
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "degrees_north"
.. .. .. ..$ vals : num [1:510(1d)] 41 41.1 41.2 41.3 41.4 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. .. ..$ :List of 11
.. .. .. ..$ name : chr "time"
.. .. .. ..$ len : int 22280
.. .. .. ..$ unlim : logi TRUE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 2
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 2
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "days since 1950-01-01 00:00:00"
.. .. .. ..$ calendar : chr "standard"
.. .. .. ..$ vals : num [1:22280(1d)] 0 1 2 3 4 5 6 7 8 9 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. ..$ varsize : int [1:3] 1068 510 22280
.. ..$ unlim : logi TRUE
.. ..$ make_missing_value: logi TRUE
.. ..$ missval : num -32768
.. ..$ hasAddOffset : logi FALSE
.. ..$ hasScaleFact : logi FALSE
.. ..- attr(*, "class")= chr "ncvar4"
..$ tasmin:List of 22
.. ..$ id :List of 5
.. .. ..$ id : num 5
.. .. ..$ group_index: num -1
.. .. ..$ group_id : int 65536
.. .. ..$ list_index : num 3
.. .. ..$ isdimvar : logi FALSE
.. .. ..- attr(*, "class")= chr "ncid4"
.. ..$ name : chr "tasmin"
.. ..$ ndims : int 3
.. ..$ natts : int 5
.. ..$ size : int [1:3] 1068 510 22280
.. ..$ dimids : int [1:3] 0 1 2
.. ..$ prec : chr "float"
.. ..$ units : chr "degC"
.. ..$ longname : chr "Daily Minimum Near-Surface Air
Temperature"
.. ..$ group_index : int 1
.. ..$ chunksizes : logi NA
.. ..$ storage : num 2
.. ..$ shuffle : logi FALSE
.. ..$ compression : logi NA
.. ..$ dims : list()
.. ..$ dim :List of 3
.. .. ..$ :List of 10
.. .. .. ..$ name : chr "lon"
.. .. .. ..$ len : int 1068
.. .. .. ..$ unlim : logi FALSE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 0
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 0
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "degrees_east"
.. .. .. ..$ vals : num [1:1068(1d)] -141 -141 -141 -141 -141 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. .. ..$ :List of 10
.. .. .. ..$ name : chr "lat"
.. .. .. ..$ len : int 510
.. .. .. ..$ unlim : logi FALSE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 1
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 1
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "degrees_north"
.. .. .. ..$ vals : num [1:510(1d)] 41 41.1 41.2 41.3 41.4 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. .. ..$ :List of 11
.. .. .. ..$ name : chr "time"
.. .. .. ..$ len : int 22280
.. .. .. ..$ unlim : logi TRUE
.. .. .. ..$ group_index : int 1
.. .. .. ..$ group_id : int 65536
.. .. .. ..$ id : int 2
.. .. .. ..$ dimvarid :List of 5
.. .. .. .. ..$ id : int 2
.. .. .. .. ..$ group_index: int 1
.. .. .. .. ..$ group_id : int 65536
.. .. .. .. ..$ list_index : num -1
.. .. .. .. ..$ isdimvar : logi TRUE
.. .. .. .. ..- attr(*, "class")= chr "ncid4"
.. .. .. ..$ units : chr "days since 1950-01-01 00:00:00"
.. .. .. ..$ calendar : chr "standard"
.. .. .. ..$ vals : num [1:22280(1d)] 0 1 2 3 4 5 6 7 8 9 ...
.. .. .. ..$ create_dimvar: logi TRUE
.. .. .. ..- attr(*, "class")= chr "ncdim4"
.. ..$ varsize : int [1:3] 1068 510 22280
.. ..$ unlim : logi TRUE
.. ..$ make_missing_value: logi TRUE
.. ..$ missval : num -32768
.. ..$ hasAddOffset : logi FALSE
.. ..$ hasScaleFact : logi FALSE
.. ..- attr(*, "class")= chr "ncvar4"
- attr(*, "class")= chr "ncdf4"
Thank you,
------------------
"Namaste ??????"
Aseem Sharma
Graduate Research Assistant
Northern Hydrometeorology Group(NHG)
Natural Resources and Environmental Studies Institute(NRESi)
University of Northern British Columbia
Prince George, BC, V2N 4Z9, Canada
Tel: 250-960-5427
Web: http://www.unbc.ca/
"All know the Way, but few actually walk it."
"????? ?????? ???? ?"
On Tue, Aug 26, 2014 at 5:52 PM, Roy Mendelssohn <roy.mendelssohn at noaa.gov>
wrote:
Using the ncdf4 library requires some knowledge of netcdf files and how
they work. However, if you can provide the following information I may be
able to provide some pointers. I am assuming your file is named
"myFile.nc". Where you see that replace with the actual name.
library(ncdf4)
myFile<-nc_open('myFile.nc')
str(myFile)
The output of the last command will show what is basically a dump of
metadata content of the file, showing its structure. From the bounds I
assume this is a Canadian dataset?
-Roy
On Aug 26, 2014, at 4:46 PM, Aseem Sharma <nature.aseem at gmail.com> wrote:
Hi,
I have this huge ( ~30GB) .nc file (NC_FORMAT_NETCDF4_CLASSIC)) for the
whole country 141.00 to 52.00 W, 41.00 to 84.00 N".
I am trying to clip this big dataset for a small region specific domain
(120.00 to 130.00 W, 50.00 to 60.00 N).
I am trying to do using netCDF4 r package but could not figure out how to
do so.
Kindly please suggest me how should i proceed.
Thank you,
[[alternative HTML version deleted]]
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
**********************
"The contents of this message do not reflect any position of the U.S.
Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/
"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK
Jr.