[Thread Prev][Thread Next][Index]

Re: [ferret_users] Appending multiple nc files into single



Reddy,
You can also do this easily with Ferret. Have a look at the topics under "append" in the index to the Ferret Users Guide
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/index-1/index/

The example in the documentation which shows appending to a netCDF file has the input files in ascii format. Your example would be much easier,

yes? use file1.nc
yes? save/clobber/file=outfile.nc uvar
yes? cancel data file1

yes? use file2.nc
yes? save/append/file=outfile.nc vvar
yes? cancel data file2

yes? use file3.nc
yes? save/append/file=outfile.nc uvar
yes? cancel data file3

yes? use file4.nc
yes? save/append/file=outfile.nc vvar
yes? cancel data file4

...


This assumes that the files have time defined consistently, that is they have time axes with time in the same units and with the same time origin. (CDO also has requirements on the time information in the files, so it can make sense of the time steps.)

If the grids  in the files do not have time axes, or if they are not defined consistently, you can use Ferret to define a common time axis and to define variables regridded to that time axis, and then write those to the output file.  The Notes in the documentation on SAVE talks about these in more detail,

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



On 10/2/2013 1:09 PM, Fabrício Zimmerer Murta wrote:
Instead of using ferret for that, you may use the ‘cdo’ (NetCDF operators) with the merge and copy or cat options:
cdo merge u1_wind.nc v1_wind.nc uv1_wind.nc
cdo merge u2_wind.nc v1_wind.nc uv2_wind.nc
cdo copy uv1_wind.nc uv2_wind.nc uv_wind.nc
 
You can make a whole loop to cycle thru all files. CDO has an extensive documentation and has compatibility support for Ferret and GrADS. See CDO’s manual pages 25 and 27 (chapters 2.2.1 and 2.2.3). Sorry if that was not the solution you were looking for, but it is very simple once you have CDO handy. Ubuntu at least can install cdo via an apt-get.
 
- fabricio
 
Sent: Wednesday, October 02, 2013 1:34 PM
Subject: [ferret_users] Appending multiple nc files into single
 
Dear Ferret users,
I have netcdf wind data for two months in the following fashion.

u1_wind.nc; v1_wind.nc (For January month)
u2_wind.nc; v2_wind.nc (For February month)

It would be helpful for me if anyone tell how to write a script for me to append these files into a single netcdf file.

Regards,
Reddy
 


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

Privacy Policy | Disclaimer | Accessibility Statement