Re: Trouble in writing .nc

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Sep 14 2010 - 11:00:36 MDT

On Sep 13, 2010, at 10:52 PM, Norbert Bonnici wrote:

> Hi
> here is my script:
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> input = addfile("/Users/Bertu/Downloads/temp.nc", "r")
> vair = input->air
> ;time = input->time
> xAir = month_to_season12 (vair)
> system("/bin/rm -f output.nc")
> output = addfile("output.nc", "c")
> filedimdef(output, "time", -1, True)
> ;output->air = vair
> vair!0 = "lon"
> vair!1 = "lat"
> vair@lon = xAir&lon
> vair@lat = xAir&lat
> vair@long_name = "Seasonal Average of Temperature"
> vair@units = "deg C"
> output->xAir = xAir
>
> end
>
> can you tell me what's wrong?
> It's supposed to work but it's only writing the same data with the new name.
> Thanks

Dear Norbert,

Since you are writing "xAir" out to the file, this should have contained your new values.

However, you attached all the metadata to "vair", which is your input variable. I think you meant to attach this stuff to xAir. That should fix the problem.

--Mary

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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 14 10:00:47 2010

This archive was generated by hypermail 2.1.8 : Thu Sep 16 2010 - 11:05:24 MDT