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

Caroline Papadopoulos cpapadopoulos at ucsd.edu
Fri Mar 11 16:38:40 EST 2016


Hi Gael,

thanks!!!

"wrt to having 'just one variable found in varlist’ I am not sure why you
would want to do this since the variables in varlist that are not in the
MITprof file will be disregarded. Unless there is an issue I am
overlooking, I would only add to varlist."

Yes I am only adding to defined variables, the issue occured when the
MITprof file only had one
variable, so even though I had a full varlist, as you say the other
variables were
disregarded, so, I ended up with just one, which affected how squeeze
worked.  Here
is how I fixed it, but, it might be an issue??  This is starting at line 78
where you are
in %loop over model files:


                if varCount > 1;
                    tmp1=tmp1(tmp4,:); tmp2=tmp2(tmp4,:); tmp3=tmp3(tmp4,:);
                else
                    tmp1=tmp1(tmp4);
                    tmp2=tmp2(tmp4);
                    tmp3=tmp3(tmp4,:);
                end; % varCount > 1

which as far as I can tell fixed the problem ??  My guess is this is an
edge case
and usually there is at least 2 variables SALT and THETA, but not so for
this particular case.

  "If I count correctly there are 4 places where code needs to be added to
add a new variable:
  profiles_prep_select.m, profiles_prep_load_fields.m,
profiles_prep_tests_cmpatlas.m
  and MITprof_gcm2nc.m. Is this what you found?"

Ah, I did not find the other dependencies on profiles_prep_select.m,
profiles_prep_load_fields.m, profiles_prep_tests_cmpatlas.m, but, I am not
running the full gcmfaces package.  I will have
to go and investigate this, THANKYOU for the tip.  I did not get any
errors. I will have to
check if I am using these routines and fix.

Thanks again,

Caroline





On Fri, Mar 11, 2016 at 10:16 AM, gael forget <gforget at mit.edu> wrote:

> Hi Caroline,
>
> sorry for the delayed response. Glad to hear that you like the updated
> MITprof code.
>
> - MITprof_gcm2nc.m is indeed the replacement of netcdf_ecco_recompose.m
> - I just revised line number 46 in MITprof_gcm2nc.m — I added missed this
> one indeed, thanks.
> - wrt to having 'just one variable found in varlist’ I am not sure why you
> would want to do this since
>   the variables in varlist that are not in the MITprof file will be
> disregarded. Unless there is an issue
>   I am overlooking, I would only add to varlist.
> - If I count correctly there are 4 places where code needs to be added to
> add a new variable:
>   profiles_prep_select.m, profiles_prep_load_fields.m,
> profiles_prep_tests_cmpatlas.m
>   and MITprof_gcm2nc.m. Is this what you found?
>
> Cheers,
> Gael
>
> On Feb 18, 2016, at 7:35 PM, Caroline Papadopoulos <cpapadopoulos at ucsd.edu>
> wrote:
>
> 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
> ==
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
>
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
>
>


-- 
-- 
==  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/20160311/c3847be4/attachment-0001.htm>


More information about the MITgcm-support mailing list