Re: .nc file writing problem

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Jul 09 2010 - 16:02:28 MDT

You put the *variable* names. filedimdef want *dimension* names

         dimNames = (/"time", "lat", "lon"/)
        dimSizes = (/ -1 , nlat, nlon /)
        dimUnlim = (/ True , False, False/)
        filedimdef(ncdf,dimNames,dimSizes,dimUnlim)

Please look at

         http://www.ncl.ucar.edu/Applications/method_2.shtml

On 07/09/2010 02:50 PM, Ioana Colfescu wrote:
> Hi,
>
> Could someone please help me with the following problem : I try to write a .nc file containing 5 variables extracted from 5 separate other .nc files.
> I try to do it with the following code but it doeson't work :
>
> ---------------------------------------------------
> variables to write in the nc file (needed for the coupler)
> ---------------------------------------------------
> taux=f1->TAUX(0:355,:,:)
> tauy=f2->TAUY(0:355,:,:)
> fsns=f3->FSNS(0:355,:,:)
> lhflx=f4->LHFLX(0:355,:,:)
> flns=f5->FLNS(0:355,:,:)
> ;-------------------------------------------------
> ;create a new nc file with the 5 variables
> ;-------------------------------------------------
> ;system ("rm "+"new.nc")
> ncdf =addfile("new.nc","c")
> time =356
> lon = 256
> lat = 128
> att_names =(/"taux","tauy","fsns","lhflx","flns"/)
> att_dims =(/"time","lat","lon"/)
> ;var_types=(/"float","float","float","float","float"/)
> dimUnlim = (/False,False,False/)
> filedimdef(ncdf,att_names,att_dims,dimUnlim)
>
> (I think there are things I'm missing anyways since I don't write anywhere the grid step for example)
>
> The error I get is :
>
> fatal:Argument type mismatch on argument (2) of (filedimdef) can not coerce
> fatal:Execute: Error occurred at or near line 32 in file extract.ncl
>
>
> Thank you,
>
> Ioana
> _______________________________________________
> 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 Fri Jul 9 16:02:32 2010

This archive was generated by hypermail 2.1.8 : Mon Jul 19 2010 - 09:39:02 MDT