Dear Ansley, It is perfect and thanks for the solution. I have another question: If I have around 10 files, each contains 12 months data for same variables (ocean.19900101.nc, ocean.19910101.nc upto ocean.19990101.nc). These files have noleap calender. I want to handle their entire time period and work with some particular variable and plot its time series. I don't want first to save particular variable in one file and then open this new file to work with (It will take longer time). Actually my intention is to open all the input files and define their entire time period and then change this entire time axes to a newer time axis which you explained in you last email. Regarding merging all files, I could use cdo or nco but I don't want to work this way because the resultant merged file is very big in size (around 70 GB). Actually this question is continuation of last question regarding changing time axes. In short I just wanted to open all these files in Ferret and wanted to use their entire time and bring my required variable on new time axis as we you explained it already. Date: Fri, 11 Jan 2013 12:46:04 -0800 From: ansley.b.manke@xxxxxxxx To: couragetoknowgc@xxxxxxxxxxx Subject: Re: [ferret_users] How to modify time axis Hi, To do what I suggested, you would add the /NOLEAP qualifier to the DEFINE AXIS command. We can get information about this axis using the unix tool "ncdump". This command will list the netcdf header and the variables time and time_bnds. /home/users/ansley> ncdump -v time,time_bnds temp.nc The header shows the attributes of the time axis are these, so you can see the calendar attribute and the units and origin of the axis. double time(time) ; time:standard_name = "time" ; time:bounds = "time_bnds" ; time:units = "days since 1990-01-01 00:00:00" ; time:calendar = "365_day" ; In the data section of the listing are the time coordinates and the time bounds: time = 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396, 424, 455, 485, 516, 546, 577, 608, 638, 669, 699, 730 ; time_bnds = 0, 31, 31, 59, 59, 90, 90, 120, 120, 151, 151, 181, 181, 212, 212, 243, 243, 273, ... So, the first coordinate value on the time axis is 31 days since 1-jan-1990, and that's Feb 1. This is an unusual definition, having the time coordinates at the end of each grid cell. More typically, the time coordinate would be in the middle of each grid cell. So more often a time axis would have something like time = 15.5, 45, ... If you want to change this, you could use the bounds to redefine the axis, using the coordinate data from the file. Monthly axes are always tricky because the months are not the same length. To put the time coordinate in the middle of the grid cell, you could use the /edges qualifier on the define command, yes? use temp.nc yes? define axis/edges/t0=1-jan-2000/units=days time = tboxlo[gt=temp] Although this isn't quite everything we need. It doesn't give us the upper limit of the last grid cell. So, try this script. Does it give you what you want? yes? use temp ! variables with the lower and higher limits of each month yes? let tlo = tboxlo[gt=temp] yes? let thi = tboxhi[gt=temp] yes? list tlo,thi ! variable with just the upper limit of the last grid cell yes? let highest = thi[t=@max] ! variable with the edges of all the months in the data yes? let box_edges = tcat(tlo, highest) yes? list box_edges ! Define an axis starting in jan 2000, with these numbers as the edges of the month. ! the coordinates of the time axis will be in mid-month. yes? define axis/noleap/edges/t0=1-jan-2000/units=days time = box_edges I can help with more ideas if you want. On 1/11/2013 1:24 AM, Star Physicist
wrote:
|