[R-sig-Geo] dates with brick and multilayer netcdf file are off

Ariel Ortiz-Bobea aortizbobea at arec.umd.edu
Tue Oct 23 21:17:29 CEST 2012


Great, good to know!
Thanks,
Ariel

---
Ariel Ortiz-Bobea
PhD Candidate, Agricultural & Resource Economics
University of Maryland - College Park
________________________________________
From: Robert Hijmans [via R-sig-geo] [ml-node+s2731867n7581343h59 at n2.nabble.com]
Sent: Monday, October 22, 2012 2:35 AM
To: Ariel Ortiz Bobea
Subject: Re: dates with brick and multilayer netcdf file are off

Ariel,

I added support for the 360 days calendar a while ago --- for processing
IPCC CMIP5 files like you do (but I think it is not on CRAN yet). Below is
what I get with the development version (on R-Forge); and that seems to be
correct. Unfortunately install from R-Forge currently does not work. I
expect this to be on CRAN in a week or two.

Robert

> r <- brick("tasmin_day_HadGEM2-ES_rcp85_r1i1p1_20991201-20991230.nc")
> r
class       : RasterBrick
dimensions  : 145, 192, 27840, 30  (nrow, ncol, ncell, nlayers)
resolution  : 1.875, 1.25  (x, y)
extent      : -0.9375, 359.0625, -90.625, 90.625  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84
data source :
e:\tmp\tasmin_day_HadGEM2-ES_rcp85_r1i1p1_20991201-20991230.nc
names       : X2099.12.01, X2099.12.02, X2099.12.03, X2099.12.04,
X2099.12.05, X2099.12.06, X2099.12.07, X2099.12.08, X2099.12.09,
X2099.12.10, X2099.12.11, X2099.12.12, X2099.12.13, X2099.12.14,
X2099.12.15, ...
Date        : 2099-12-01, 2099-12-30 (min, max)
varname     : tasmin

>


On Thu, Oct 18, 2012 at 11:14 AM, Ariel Ortiz-Bobea <
[hidden email]</user/SendEmail.jtp?type=node&node=7581343&i=0>> wrote:

> Hello,
>
> I'm having a problem when trying to import a multi-layer netcdf file using
> brick() in the raster package. The dates in the raster/brick object are off
> by a lot and after importing the file I get the warning message:
>
>     In .doTime(r, nc, zvar, dim3) : assuming a standard calender
>
> The netcdf files corresponds to the output of a climate model with years of
> 360 days so perhaps this has to do with the problem. I suppose the .doTime
> function is having a hard time extracting this date format.
>
> I selected a small file of 30 days (3.4MB) that you can download to
> reproduce the problem:
>
> https://dl.dropbox.com/u/45311184/tasmin_day_HadGEM2-ES_rcp85_r1i1p1_20991201-20991230.nc
>
> That file contains data for time periods 2099/12/01-2099/12/30. When
> imported, the reported range of dates is 2096/06/20-2096/07/19. So it's 30
> time periods, but the wrong ones.
>
> I could manually set the time periods given that I know the boundary dates
> and the time step, but I rather have a more elegant solution.
>
> Any help would be great.
>
> Thanks,
>
> Ariel
>
>
> # Reproducible code: #-----------------
>
> # load package
>    library(raster)
>
> # Working directory where you placed the nc file
>    setwd("/Users/Ariel/Downloads")
>
> # Load file
>    r <- brick("tasmin_day_HadGEM2-ES_rcp85_r1i1p1_20991201-20991230.nc",
> varname="tasmin")
>    # here I get the following warning:
>    # Warning message:
>    # In .doTime(r, nc, zvar, dim3) : assuming a standard calender
>
> # See layer names
>    r at layernames # does not match the 2099/12/01-2099/12/30 time period,
> dates are off ~ 2.5 years
>
>
>
>
> -----
> Ariel Ortiz-Bobea
> PhD Candidate in Agricultural & Resource Economics
> University of Maryland - College Park
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/dates-with-brick-and-multilayer-netcdf-file-are-off-tp7581332.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]</user/SendEmail.jtp?type=node&node=7581343&i=1>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]</user/SendEmail.jtp?type=node&node=7581343&i=2>
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


________________________________
If you reply to this email, your message will be added to the discussion below:
http://r-sig-geo.2731867.n2.nabble.com/dates-with-brick-and-multilayer-netcdf-file-are-off-tp7581332p7581343.html
To unsubscribe from dates with brick and multilayer netcdf file are off, click here<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7581332&code=YW9ydGl6Ym9iZWFAYXJlYy51bWQuZWR1fDc1ODEzMzJ8LTYxMzExNzA2NQ==>.
NAML<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




-----
Ariel Ortiz-Bobea
PhD Candidate in Agricultural & Resource Economics
University of Maryland - College Park
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/dates-with-brick-and-multilayer-netcdf-file-are-off-tp7581332p7581370.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list