[Thread Prev][Thread Next][Index]

Re: [ferret_users] Writting a sample netcdf file with Julian calendar (unit=days)



Hi,
You should be able to use the time axis from your file.  It starts at the same time, and is longer than the time axis that you wanted. Initializing the dataset the file will put the definition of axis "time" into Ferret, so you can just specify it in your grid definition and then write the time range that you want.

!********************************Script to create a dummy netcdf file


define the axes and grids
! temperature axes
define axis/x=130e:80w:2/unit="degrees" xt
define axis/y=20s:20n:2/unit="degrees" yt

! velocity axes (staggered relative to temperature)
define axis/x=131e:79w:2/unit="degrees" xu
define axis/y=19s:21n:2/unit="degrees" yu

! time axis
!!! define axis/t="16-jan-1850:00:00":"16-dec-2013:00:00":31/calendar=julian/unit="days" time
!!! axis is defined in the dataset extlw
use extlw

! define the grids
define grid/x=xt/y=yt/t=time gt
define grid/x=xu/y=yu/t=time gu

! define the (dummy) variables
let u = SIN((x[g=gu]+y[g=gu]+t[g=gu])/100)
let temp = SIN((x[g=gt]+y[g=gt]+t[g=gt])/100)
set variable/title="Temperature"/units="centigrade" temp
set variable/title="Zonal Velocity"/units="m/sec" u
SET MEMORY/SIZE=1000
! create the template NetCDF file

!!! save the desired date range
save/file=template.cdf/t="16-jan-1850:00:00":"16-dec-2013:00:00" temp,u

On 1/3/2014 10:50 AM, Star Physicist wrote:
Dear Ansley,

Please find attached ncdump -c information of a file that I am giving as an input aerosol data to my GFDL CM2.1 model and it is using julian calendar with proper month lengths. I need this format of calendar because model is not working with standard calendar.
Thanks,


Mubashar


Date: Thu, 2 Jan 2014 09:58:00 -0800
From: ansley.b.manke@xxxxxxxx
To: couragetoknowgc@xxxxxxxxxxx; ferret_users@xxxxxxxx
Subject: Re: [ferret_users] Writting a sample netcdf file with Julian calendar (unit=days)

Hi Mubashar
You want to define an irregularly-spaced axis, so that the months have the right number of days for each.  This is discussed under the heading "calendar" in the Users Guide,  In the index see, CALENDAR, DEFINE AXIS/CALENDAR.

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/DEFINE#_VPINDEXENTRY_1306

and particularly, scroll down in that section to the part about using /EDGES to make a true monthly axis. Noted in that same section there is a script that will define a monthly axis in units of days, for the standard Gregorian calendar, the NOLEAP, ALL_LEAP, and 360-day calendars.

yes? go/help def_monthaxis_days

Now, for a Julian calendar, the logic doesn't quite work.  One could think of make February 28.25 days long, but then the months after February would start not at hour 00 but elsewhere.  I suppose there could be a 4-year calendar defined with all of the correct month lengths. 

Can your work possibly use the Gregorian calendar?

Ansley


On 1/2/2014 5:45 AM, Star Physicist wrote:
Dear Ferret users,

I am trying to create a sample file for temperature and zonal velocity by using Julian calendar with units as days. Follwing script works fine but there is a small issue. I need the increment (delta) in define statement to be exact number of days (Jan=31, Feb=28 or 29 and so on) instead of fixed 31 that I am using currently. Can you please help me to modify my script in order to fulfil the requirement.

Thanks,

Mubashar

!********************************Script to create a dummy netcdf file

define the axes and grids
! temperature axes
define axis/x=130e:80w:2/unit="degrees" xt
define axis/y=20s:20n:2/unit="degrees" yt

! velocity axes (staggered relative to temperature)
define axis/x=131e:79w:2/unit="degrees" xu
define axis/y=19s:21n:2/unit="degrees" yu

! time axis
define axis/t="16-jan-1850:00:00":"16-dec-2013:00:00":31/calendar=julian/unit="days" time
! define the grids
define grid/x=xt/y=yt/t=time gt
define grid/x=xu/y=yu/t=time gu

! define the (dummy) variables
let u = SIN((x[g=gu]+y[g=gu]+t[g=gu])/100)
let temp = SIN((x[g=gt]+y[g=gt]+t[g=gt])/100)
set variable/title="Temperature"/units="centigrade" temp
set variable/title="Zonal Velocity"/units="m/sec" u
SET MEMORY/SIZE=1000
! create the template NetCDF file
save/file=template.cdf temp,u



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement