[MITgcm-devel] problem with gluemnc ?
Ryan Abernathey
rpa at MIT.EDU
Wed Aug 19 16:14:21 EDT 2009
Jean-Michel,
Thanks for noticing that error with the 1D vars.
I have updated gluemnc again to keep the 1D vectors when gluing grid
files. (New version is attached.)
So now you can glue you grids into one single grid file. I don't know
if anyone else cares about this, but it is useful if you want to do
offline calculations.
-Ryan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gluemnc
Type: application/octet-stream
Size: 10796 bytes
Desc: not available
URL: <http://mitgcm.org/pipermail/mitgcm-devel/attachments/20090819/40329a37/attachment.obj>
-------------- next part --------------
--- gluemnc_old 2009-08-11 18:35:36.000000000 -0400
+++ gluemnc 2009-08-19 16:12:49.000000000 -0400
@@ -342,6 +342,26 @@
ncwa $DEBUG -O -a T $somepre.glob.nc $somepre.glob.nc
fi
+ # another hack by rpa to accomodate grid.nc files
+ # (there are several variables with just Z dimension that we want
to keep)
+ varsz=$( ncdump -h $somepre.t001.nc | sed -n 's/^\s*\(double\|float
\).* \(\w*\)(Z\w*).*/\2/p' )
+ fixed=
+ for varz in $varsz
+ do
+ # check to make sure the variable doesn't already exist in the glob
file
+ if [[ -z $( ncdump -h $somepre.glob.nc | grep " $varz(" ) ]]
+ then
+ echo "Adding variable $varz to $somepre.glob.nc"
+ ncecat $DEBUG -A -u TMPrecord -v $varz $somepre.t001.nc
$somepre.glob.nc > $LOGFILE
+ fixed='yes'
+ fi
+ done
+
+ if [ -n "$fixed" ]
+ then
+ ncwa $DEBUG -O -a TMPrecord $somepre.glob.nc $somepre.glob.nc
+ fi
+
cp $somepre.glob.nc $DIRORIG
done
On Aug 13, 2009, at 6:12 PM, Jean-Michel Campin wrote:
> Hi Martin,
>
> Thanks for your advise.
> I will check-in this fix, + do something about the number at the
> beginning (since there might be some folks like me who got their
> netcdf pkg from fc11 and don't want to re-install netcdf 4.0.1).
> And then I will add what Ryan gave me to apply gluemnc to
> grid.*.nc files (although it seems to drop the 1.D vector
> like drF, drC ... a bit annoying).
> Cheers,
> Jean-Michel
>
> On Thu, Aug 13, 2009 at 08:52:17AM +0200, Martin Losch wrote:
>> Hi Jean-Michel,
>>
>> I can confirm that with netcdf 3.6.2 it works for my but for netcdf
>> 4.0
>> it doesn't (on the same linux computer).
>>
>> Actually on the netcdf site, the bug with numbers at the beginning of
>> the file name is already documented along with a fix (basically
>> upgrade
>> to 4.0.1)
>> <http://www.unidata.ucar.edu/software/netcdf/docs/
>> known_problems.html>
>> I haven't seen a bug report for the other problem (multiple files
>> on the
>> command line), but in glumnc this workaround could work:
>> Instead of
>>> withY=$(ncdump -h $countxx.$somevar.$somepre.*.nc | grep "Y =")
>>> withYp1=$(ncdump -h $countxx.$somevar.$somepre.*.nc | grep "Yp1
>>> =")
>> use this
>>> filelist=(`ls $countxx.$somevar.$somepre.*.nc`)
>>> withY=$(ncdump -h ${filelist[0]} | grep "Y =")
>>> withYp1=$(ncdump -h ${filelist[0]} | grep "Yp1 =")
>>
>> Martin
>>
>> On Aug 12, 2009, at 11:38 PM, Jean-Michel Campin wrote:
>>
>>>
>>> Looks like it's related to the version of ncdump/netcdf:
>>> It does not work with my version:
>>>> netcdf library version "4.0" of Feb 26 2009 03:56:01 $
>>> but on beagle it works with:
>>>> netcdf library version "3.6.2" of Oct 26 2007 12:30:01 $
>>>
>>> Jean-Michel
>>>
>>> On Wed, Aug 12, 2009 at 12:24:52PM -0400, Jean-Michel Campin wrote:
>>>> Hi,
>>>>
>>>> I tried to use gluemnc for the output of exp. ideal_2D_oce
>>>> and also global_ocean.90x40x15 , statring with "state.*.t*.nc"
>>>> files.
>>>>
>>>> I did not get the right single netcdf file at the end,
>>>> but when I comment out the 2 lines 277,278 in gluemnc:
>>>>> withY=$(ncdump -h $countxx.$somevar.$somepre.*.nc | grep "Y =")
>>>>> withYp1=$(ncdump -h $countxx.$somevar.$somepre.*.nc | grep
>>>>> "Yp1 =")
>>>> then it seems to work much better.
>>>>
>>>> Is there something wrong there ? Or did I miss something ?
>>>>
>>>> Jean-Michel
>>>>
>>>>
>>>> _______________________________________________
>>>> MITgcm-devel mailing list
>>>> MITgcm-devel at mitgcm.org
>>>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
>>> _______________________________________________
>>> MITgcm-devel mailing list
>>> MITgcm-devel at mitgcm.org
>>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
>>
>> _______________________________________________
>> MITgcm-devel mailing list
>> MITgcm-devel at mitgcm.org
>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel
More information about the MITgcm-devel
mailing list