[MITgcm-support] Questions about moving from netcdf_ecco_recompose.m to MITprof_gcm2nc.m

Caroline Papadopoulos cpapadopoulos at ucsd.edu
Thu Feb 18 19:35:18 EST 2016


Hi everyone,

I have a couple of questions about MITprof_gcm2nc.m, and I am moving
from the older (now dead code) netcdf_ecco_recompose.m, and they are
supposed
to do the same thing ?


Question 1:

I am adding additional variables similar to when OXY was added.  It
looks like when I add the variable I also need to up the number of
zeros in the initialization of varNum:

varNum=zeros(6,1);     (line number 46 in MITprof_gcm2nc.m)

from 6 to the number of variables I have, the reason I ask, is this did
not change when OXY was added but think it should since there are
now 7 variables should it be varNum=zeros(7,1)  ??

Question 2:

When there is just one variable found in varlist, then
I am getting the following errors, which come from
the issue that

     ??? Index exceeds matrix dimensions.

     Error in ==> MITprof_gcm2nc at 83
                    tmp1=tmp1(tmp4,:); tmp2=tmp2(tmp4,:); tmp3=tmp3(tmp4,:);

Note I have put in extra lines for diagnostics, so it really should
be line number 70 of the checked in code.  This works fine if I have more
than one variable
found in varlist.

The issue is with the block:

           for v=1:varCount; vv=varList{v};
                tmp1=squeeze(tmp_prof(1:nr,1,v,:))';
tmp2=squeeze(tmp_prof(1:nr,2,v,:))'; tmp3=squeeze(tmp_prof(nr+1,1,v,:));
                tmp4=find(tmp3>0); tmp1=tmp1(tmp4,:); tmp2=tmp2(tmp4,:);
tmp3=tmp3(tmp4,:);
                eval(['prof_' vv '(tmp3,:)=tmp1; prof_' vv
'mask(tmp3,:)=tmp2;']);
            end;

where varCount is 1, and tmp1 and tmp2 have dimensions 1x223, 1x223 in my
example, and so then
they are vectors not arrays, since squeeze works differently, so I am not
sure the best way to fix this.  I am trying to get away from mexnc to
native matlab and I am running on matlab 2015a.  I am not fully sure what
this block of
code is doing ??  Getting the profile and mask for the variable vv is as
far as I get.

Mostly things are working as far as I can tell, and the new code is so nice
and clean and
easy to add variables such as you did for OXY, just 3 places.

I have it working for all my profile files except for one other, I am still
root causing where
that one is failing, it fails in writing the netcdf file.  I have uploaded
the latest gcmfaces
as of today :-)

thanks,

Caroline


-- 
-- 
==  Caroline Papadopoulos                    CASPO Division
==                                                        Scripps
Institution of Oceanography
==  office:450 Nierenberg Hall                 9500 Gilman Drive, Dept 0230
==  email:cpapadopoulos at ucsd.edu <email:caroline at ucsd.edu>       University
of California, San Diego
==  Phone:(858) 822-2726                       La Jolla, CA 92093-0230
==
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20160218/dabfe052/attachment.htm>


More information about the MITgcm-support mailing list