Re: Concatenating netcdf files

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed May 12 2010 - 11:16:26 MDT

On 05/12/2010 11:04 AM, Timothy Wynne wrote:
> Hello,
> I have 2 files that have the same variables and attributes.
> I would like to concatenate them to make one file.
> Is there a simple way to do this in NCL?
>
> I have tried the attached script that i tried to write using 2 examples
> from the website.
> Thank you,
> Tim
=======================================
There are two ways of concatenating files.

[1] netCDF Operators [NCO]
     %> ncrcat *cast*.nc newCast.nc

[2] NCL variables imported from nc file have associated with them
the appropriate coordinate information. There is *no need* to read
or write them directly.

all_files = systemfunc("ls /projects/oil_spill/test/*cast*.nc")
fall=addfiles(all_files, "r")
ListSetType(fall, "cat")

water_u =fall[:]->water_u
printVarSummary(water_u)

water_v =fall[:]->water_v
printVarSummary(water_v)

;=====================================================================
        diro = "./"
        filo = "simple.nc"
        system ("/usr/bin/rm "+diro+filo)
        ncdf = addfile(diro+filo ,"c") ;
     ; make time and UNLIMITED dimension
        filedimdef(ncdf,"time",-1,True)
    ; output variables directly
        ncdf->water_u=water_u
        ncdf->water_v=water_v

>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 12 11:16:32 2010

This archive was generated by hypermail 2.1.8 : Thu May 13 2010 - 10:03:00 MDT