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

gael forget gforget at mit.edu
Fri Mar 11 13:16:33 EST 2016

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?


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       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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20160311/a6f1d181/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1843 bytes
Desc: not available
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20160311/a6f1d181/attachment.p7s>

More information about the MITgcm-support mailing list