[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to cancatenate nc files that have no time dimension ?



Hi,
You can define a time axis with the correct times, and add a variable which is 0*time on that axis to your input data. This has the effect of putting your data onto a time axis, then you can write out the appropriate timestep to an output file.  The ideas are shown under "Timestamp", a few paragraphs down in this section:

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/SAVE

yes? DEFINE AXIS/T="1-JUL-1980":"1-JUL-1985":1/UNIT=year tannual
yes? LET timestamp = T[Gt=tannual] * 0 !always 0

yes? use data_1980.nc
yes? let var_with_time = var + timestamp
yes? set attributes/like=var var_with_time
yes? save/t=1-JUL-1980/file=timedata.nc var_with_time
yes? cancel data 1980

yes? use data_1981
... same definitions, save the data in 1981.
The variable 'var_with_time' is defined at all timesteps, but you write out only the one at the desired time, so that the data for 1980 is associated with the timestep in 1980, and so forth.

You can even preserve the original variable names, by renaming the incoming variable to another name, then using the original variable in the modified version of it.
yes? use data_1980.nc
yes? set var/name=var_in var
yes? let var = var_in + timestamp
...


On 3/27/2016 6:27 AM, Kishore Ragi wrote:
Hi ferret users,

I have multiple files with time specified in the file name, but there is no time dimension. I would like to add time dimension and merge all the files into one.

Could anybody tell me how to combine all the files with time dimension?

I appreciate your help.
Thank you in advance.

Regards,
Kishore
PhD student in climate science,
National Institute of Technology, Rourkela,
India- 769008


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

Privacy Policy | Disclaimer | Accessibility Statement