Re: ccsm to vis5d

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 27 2012 - 12:14:29 MDT

Mary,

Thanks for the example. I was able to improve the script
with that help and now it creates a vis5d file successfully.
(I am wanting to plot sea-level pressure, precip, and 3d clouds
over Australia).
However, the data appears all empty when I try to view it in
vis5d. I can only plot the topo field, which looks fine.

I attached the 2 data files, my NCL script, and the created v5d file.

Any help would be appreciated.

(I should mention that when I run the sample script you gave me,
it runs ok, creates a vis5d file, but it also appears empty in the
vis5d software.)

Thanks for your patience.

Michael

On Mar 26, 2012, at 9:40 AM, Mary Haley wrote:

> Hi Michael,
>
> These functions were written many years ago by somebody who is
> now gone. We don't even build these into the standard NCL binaries
> because people haven't been using them.
>
> However, that doesn't mean we won't try to answer questions about them!
>
> Looking at the interface for v5d_write, it looks like the first two arguments
> must be scalar integers, and the 3rd argument must be a 3D float array of
> any dimensionality.
>
> I think you can keep using v5d_write to write 3D arrays to the same file, before
> you call v5d_close.
>
> I've attached a sample test script that I found.
>
> If this still doesn't work, let me know if you are getting an error message,
> and exactly what is happening.
>
> --Mary
> <v5dTest2.ncl>
>
>
>
>
>
> On Mar 23, 2012, at 9:38 AM, Michael Notaro wrote:
>
>> The script below gives an error in the v5d_write line about
>> the dimensions being wrong. I have never used these v5d
>> functions before and so I am doing something wrong. I
>> am trying to write 3 variables to a file and there are no such
>> examples to follow. To make things easier, I converted all
>> 3 variables to 3D and then combined them all into a variable
>> called data and then tried to write data to a v5d file with no
>> success. I am not really sure what I am doing wrong here.
>> So the problem is related to my confusion with these v5d ncl
>> function and I don't think the v5d user group will be able to
>> help me with that since they likely don't even use ncl.
>> Any advice would be appreciated here. Sorry I am so confused
>> with this.
>>
>>
>>
>>
>>
>>
>> a=addfile("test1.nc","r")
>> b=addfile("test2.nc","r")
>> psl=a->PSL(0,:,:)
>> cloud=b->CLOUD(0,:,:,:)
>> pcp=(b->PRECL(0,:,:))+(b->PRECC(0,:,:))
>> pcp=pcp*60.*60.*24.*1000. ; mm/d
>> lev=doubletofloat(a->lev)
>> lev=lev(::-1)
>> copy_VarCoords(a->lev,lev)
>> lat=doubletofloat(a->lat)
>> lon=doubletofloat(a->lon)
>> lat=lat(::-1)
>> lon=lon(::-1)
>> copy_VarCoords(a->lat,lat)
>> copy_VarCoords(a->lon,lon)
>>
>> psl=psl(::-1,:)
>> pcp=pcp(::-1,:)
>> cloud=cloud(:,::-1,:)
>>
>> psl!0="lat"
>> psl!1="lon"
>> psl&lat=lat
>> psl&lon=lon
>> pcp!0="lat"
>> pcp!1="lon"
>> pcp&lat=lat
>> pcp&lon=lon
>> cloud!0="lev"
>> cloud!1="lat"
>> cloud!2="lon"
>> cloud&lev=lev
>> cloud&lat=lat
>> cloud&lon=lon
>>
>> numtimes = 1
>> numvars = 3
>> nr = 96
>> nc = 144
>> nl = (/26,26,26/)
>>
>> varnames=(/"psl","pcp","cloud"/)
>>
>> timestamp = (/1/)
>> datestamp = (/1/)
>> compress = 1
>> northlat = 90.0
>> latinc = 1.9
>> westlon = 0.0
>> loninc = 2.5
>> projection = 1
>> proj_args = (/northlat, westlon, latinc, loninc/)
>> vert = 3
>> vert_args=lev
>>
>> data=new((/96,144,3*26/),float)
>> do i=0,25
>> data(:,:,i)=psl
>> end do
>> do i=26,51
>> data(:,:,i)=pcp
>> end do
>> data(:,:,52:77)=cloud(lat|:,lon|:,lev|:)
>>
>> v5d_create("monsoon.v5d", numtimes, numvars, nr, nc, nl, varnames, timestamp, datestamp, compress, projection, proj_args, vert, vert_args)
>> v5d_write(numtimes, numvars, data)
>> v5d_close()
>>
>>
>>
>>
>>
>> On Mar 23, 2012, at 10:29 AM, Mary Haley wrote:
>>
>>> Sorry, I misunderstood your question then. I thought the issue was with
>>> writing a vis5d file. Can you explain what you mean not being sure how to
>>> handle vertical coordinates?
>>>
>>> --Mary
>>>
>>> On Mar 23, 2012, at 8:21 AM, Michael Notaro wrote:
>>>
>>>> Thanks.
>>>> Hopefully someone will email an answer, although I doubt it since
>>>> it is more of an NCL question than a vis5d question.
>>>>
>>>>
>>>>
>>>> On Mar 23, 2012, at 7:56 AM, Mary Haley wrote:
>>>>
>>>>> Hi Michael,
>>>>>
>>>>> I'm afraid we don't have any vis5d experience in our group. I've CCed the vis5dplus group on this question and your other one.
>>>>>
>>>>> If you want to join that group:
>>>>>
>>>>> http://mailman.ucar.edu/mailman/admin/vis5dplus
>>>>>
>>>>> --Mary
>>>>>
>>>>> On Mar 21, 2012, at 5:20 PM, Michael Notaro wrote:
>>>>>
>>>>>> I am trying to convert sea-level pressure, precipitation, and cloud
>>>>>> cover at all 26 levels on 1.9x2.5 degree grid from CCSM3.5 to
>>>>>> a vi5d file for a single time step. Could you someone take a look
>>>>>> at the code below and offer some suggestions? I am particularly
>>>>>> not sure how to handle the vertical coordinates or multiple variables.
>>>>>> Sorry, I have no experience with vis5d up to now so this is my first
>>>>>> try to convert the data into that format.
>>>>>>
>>>>>> Michael
>>>>>>
>>>>>>
>>>>>>
>>>>>> a=addfile("test1.nc","r")
>>>>>> b=addfile("test2.nc","r")
>>>>>> psl=a->PSL(0,:,:)
>>>>>> cloud=b->CLOUD(0,:,:,:)
>>>>>> pcp=(b->PRECL(0,:,:))+(b->PRECC(0,:,:))
>>>>>> pcp=pcp*60.*60.*24.*1000. ; mm/d
>>>>>> copy_VarCoords(psl,pcp)
>>>>>> lat=doubletofloat(a->lat)
>>>>>> lon=doubletofloat(a->lon)
>>>>>> copy_VarCoords(a->lat,lat)
>>>>>> copy_VarCoords(a->lon,lon)
>>>>>>
>>>>>> numtimes = 1
>>>>>> numvars = 3
>>>>>> nr = 96
>>>>>> nc = 144
>>>>>> nl = 26
>>>>>>
>>>>>> timestamp = (/1/)
>>>>>> datestamp = (/1/)
>>>>>> compress = 1
>>>>>> northlat = 90.0
>>>>>> latinc = 1.9
>>>>>> westlon = 0.0
>>>>>> loninc = 2.5
>>>>>> projection = 1
>>>>>> proj_args = (/northlat, westlon, latinc, loninc/)
>>>>>> bottomhgt = 0.0
>>>>>> hgtinc = 1.0
>>>>>> vert = 3
>>>>>> vert_args = (/bottomhgt, hgtinc/)
>>>>>> v5d_create("UVdata.v5d", numtimes, numvars, nr, nc, nl, (/"psl","pcp","cloud"/), timestamp, datestamp, compress, proj, proj_args, vert, vert_args)
>>>>>> v5d_write(numtimes, numvars, (/"psl","pcp","cloud"/))
>>>>>> v5d_close()
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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 Mar 27 12:15:46 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 09 2012 - 13:43:03 MDT