Dave,
Even with this other script, the dimensions levsoi & string_length are
lost and some variables lose their units and long_names. Something
seems wrong.
Mike
begin
system ("/bin/rm b35.012mons1.clm2.r.2193-01-01-00000.new.nc") ;
remove if exist
out = addfile("b35.012mons1.clm2.r.2193-01-01-00000.new.nc","c")
in = addfile("b35.012mons1.clm2.r.2193-01-01-00000.nc", "r")
vname = getfilevarnames(in)
do i=0,dimsizes(vname)-1
dims = getfilevardims(in,vname(i))
nrank = dimsizes(dims)
Vold = in->$vname(i)$ ; read each variable to memory
Vnew = Vold
copy_VarMeta(Vold,Vnew)
out->$vname(i)$ = Vnew
delete(Vnew)
delete(Vold)
delete(dims)
delete(nrank)
end do
end
On May 6, 2009, at 3:53 PM, David Brown wrote:
> Hi Mike,
> This doesn't sound like the correct documented behavior. Can you
> supply a test case NetCDF file that will demonstrate the problem
> using the sample code below?
> Thanks,
> -dave
>
>
> On May 6, 2009, at 2:15 PM, Michael Notaro wrote:
>
>> If I open a file, retrieve all the variables, and write them
>> to a new file, some of the variables lose their long_names and units
>> in the process, mainly integer variables. Please see below.
>> Any idea how to maintain all the variables' info, including
>> long_name, dimensions, units, etc?
>>
>> Mike
>>
>> a=addfile("originalfile.nc","r")
>> .....
>> ......
>> out=addfile("newfile.nc","c")
>> do i=0,numb-1
>> v = a->$names(i)$
>> out->$names(i)$ = v
>> delete(v)
>> end do
>>
>> _______________________________________________
>> 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 Wed May 06 2009 - 15:08:52 MDT
This archive was generated by hypermail 2.2.0 : Wed May 06 2009 - 16:48:59 MDT