[ncl-talk] How to convert to 360 days to 365 days calendar
Dennis Shea
shea at ucar.edu
Sun Jul 7 19:31:28 MDT 2019
Sorry for the very tardy reply on *360_day conversion to 365_day calendars*.
---
Another post on this same issue was sent to ncl-talk in *Feb 2019.*
My recollection is that ncl-talk has previously had calendar 360-day to
365_day conversion questions. Also, the GrADS , NCO and CDO mail lists have
had similar requests.
---
The attached function [ "*calendar_convert_360_to_365_date*" ] works on *daily
data.* It has *not* been extensively tested. There is no online NCL
documentation with examples. Please read the documentation within the
function. Note that *'linmsg_n*' is used rather that *'linint1_n*'
*%>* ncl GeethaR.360_to_365.ncl
I have placed a *source* 360-day file and the *derived* 365_day file at:
ftp ftp.cgd.ucar.edu
anonymous
your_email
cd pub/shea
mget *nc
quit
---
The files are ~ 37.5 MB
37629272 zg700_day_HadGEM2-ES_rcp85_r1i1p1_19800101-20131231_365day.nc
37314184 zg700_day_HadGEM2-ES_rcp85_r1i1p1_19810101-20141231_360day.nc
---
I have also attached a test code to make sure it work s for 4D/3D/2D/1D
variables.
*%>* ncl tst.360_to_365.ncl
I think it works! :-)
On Thu, Jun 20, 2019 at 5:25 AM Geetha R via ncl-talk <ncl-talk at ucar.edu>
wrote:
> Dear NCLers,
> I am working on converting 360 days calendar to 365 days calendar. I have
> seen a discussion on the same topic with the title "*converting 360 day
> calendar to 365 day (standard) calendar*". The script shared in the topic
> is :
>
> f = addfile("zg700_day_HadGEM2-ES_rcp85_r1i1p1_19800101-20131231.nc","r")
> var = f->zg
> time_360 = var&time
> lat = f->lat
> lon = f->lon
> plev = f->plev
> printVarSummary(var)
>
> time_steps = 34*365 ;1980 to 2013
> time_365 = fspan(1,time_steps,time_steps)
> time_365!0 = "time"
> time_365&time = time_365
> time_365 at standard_name <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "time"
> time_365 at units <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "days since 1980-01-01 12:00:00"
> time_365 at calendar <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "365_day"
> time_365 at long_name <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "time"
> time_365 at axis <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "T"
> zg_new =linint1_n( time_360,rm_single_dims(var), False, time_365, 0,0)
> zg_new!0 = "time"
> zg_new&time = time_365
> zg_new!1 = "lat"
> zg_new&lat = lat
> zg_new!2 = "lon"
> zg_new&lon = lon
> zg_new at _FillValue <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = 1.0e+20
> zg_new at missing_value <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = 1.0e+20
> zg_new at standard_name <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "geopotential_height"
> zg_new at long_name <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "Geopotential Height"
> zg_new at units <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "m"
> zg_new at coordinates <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "lon lat plev"
> zg_new at cell_methods <http://mailman.ucar.edu/mailman/listinfo/ncl-talk> = "time: mean"
> printVarSummary(zg_new)
> outf = addfile("zg700_day_HadGEM2-ES_rcp85_r1i1p1_19800101-20131231_cal.nc","c")
> outf->lat = lat
> outf->lon = lon
> outf->plev = plev
> outf->zg = zg_new
>
> In this code, the interpolation is done from the first day of the data
> that the netcdf with 365 days differs much when compared with the 360 days
> data. So, I thought that 5 days can be included at the end of each year.
> So, the interpolation can be started at 360th day and end at 361th day. I
> am new to ncl and may I know how to do this in ncl.
>
> --
> With Regards,
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190707/e25e73ae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: calendar_convert_360_to_365_date.ncl
Type: application/octet-stream
Size: 6398 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190707/e25e73ae/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GeethaR.360_to_365.ncl
Type: application/octet-stream
Size: 2551 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190707/e25e73ae/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst.360_to_365.ncl
Type: application/octet-stream
Size: 1421 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190707/e25e73ae/attachment-0002.obj>
More information about the ncl-talk
mailing list