Re: creating .nc file variables

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 12 Jul 2007 16:01:29 -0600

Hi Rosa,

You will get the "Could not create..." fatal message from NCL if you
are trying to create a netCDF file that already exists in your
directory.

If you are okay with removing the file before you create it, then you
can do something like:

ncdf_filename = "GBRAMS-"+files_in(i)
if(isfilepresent(ncdf_filename)) then
system("/bin/rm " + ncdf_filename)
end if
ncdf = addfile(ncdf_filename,"c")

--Mary

On Jul 12, 2007, at 3:05 PM, Rosa Maria Nascimento dos Santos wrote:

> Hi,
>
> I'm begginnig to use NCL, trying to create a .nc file and when I
> try to
> write the new variables to the file it's showing an error message
> (see the
> message in the end of this e-mail and the .ncl file attached). I don't
> know what am I doing wrong?!
>
> Could someone help me with it?!
>
> Thanks,
>
> Rosa
> ERROR MESSAGE:
> fatal:Could not create (GBRAMS-6-hourly_1980-02_all-var-old_00.nc)
> fatal:Execute: Error occurred at or near line 117 in file
> read_brams.ncl
>
> PROGRAM LINES:
> ;**** Creating output file
>
> ncdf=addfile("GBRAMS-"+files_in(i),"c")
>
> var4D_names=(/"uvel","vvel","zgeo","temp","umrl"/)
> var4D_dims=(/"time","lev","lat","lon"/)
> var4D_types=(/"float","float","float","float","float"/)
> vardims=dimsizes(temp)
>
> filedimdef(ncdf,var4D_dims,vardims,(/True,False,False,False/))
> filevardef(ncdf,var4D_names,var4D_types,var4D_dims)
> filevardef(ncdf,"psnm",typeof(pnmm),(/"time","lat","lon"/))
> filevarattdef(ncdf,"psnm",pnmm)
> filevarattdef(ncdf,"uvel",uu)
> filevarattdef(ncdf,"vvel",vv)
> filevarattdef(ncdf,"zgeo",ageo)
> filevarattdef(ncdf,"temp",temp)
> filevarattdef(ncdf,"umrl",RH)
>
>
>
> --
> Rosa Maria Nascimento dos Santos
> Doutora em Meteorologia
> LBA/INPA
> Tel: +55 92 36433623
> e-mail: rosasto_at_inpa.gov.br
> rosa_sto_at_yahoo.com
>
>
> <read_brams.ncl>_______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 12 2007 - 16:01:29 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 17 2007 - 06:52:01 MDT