Skip to content

Commit

Permalink
Merge branch 'master' of github.com:csdms-contrib/slepian_delta
Browse files Browse the repository at this point in the history
  • Loading branch information
fjsimons committed Mar 20, 2020
2 parents ddc89e2 + 3405577 commit 421b780
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 19 deletions.
2 changes: 1 addition & 1 deletion correct4gia.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
pause
end
end

total=0;
end % end if exist


Expand Down
4 changes: 2 additions & 2 deletions ellesmereg.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
else
% We make a new buffer
disp('Buffering the coastlines... this may take a while');
XY=ellesmere(10);
XY=ellesmereg(10);
if buf > 0
inout='out';
else
Expand All @@ -91,7 +91,7 @@
%%%
% First we make the thing next door (Greenland)
%%%
XY1 = ellesmere(10);
XY1 = ellesmereg(10);
if buf>0.7
XY1 = ellesmere(10,buf-0.5);
LonB=XY1(:,1); LatB=XY1(:,2);
Expand Down
54 changes: 46 additions & 8 deletions grace2plmt.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
% Pcenter 'CSR' data center at the Center for Space Research
% 'GFZ' data center at the GeoForschungsZentrum Potsdam
% Rlevel The release level of the solution you want.
% Either 'RL04' or 'RL05'
% Either 'RL04','RL05', or 'RL06'
% units 'POT' or 'SD' for whether you want geopotential or surface
% mass density
% forcenew Whether or not you want to force new generation of a save file
Expand All @@ -32,7 +32,11 @@
% thedates time stamps in Matlab time
%
% NOTE:
% The RL05 solutions from CSR do not have any standard deviations

% SLR data available from the GRACE Tellus website for RL06:
% ftp://podaac-ftp.jpl.nasa.gov/allData/grace/L2/CSR/RL06
%
% The RL05 solutions from CSR do not have any standard deviations
% given, formal or calibrated. These values will be reported as 0.
%
% SLR data available from the GRACE Tellus website:
Expand All @@ -51,26 +55,29 @@
% [potcoffs,cal_errors,thedates]=grace2plmt('CSR','RL05','SD',1);
%
%
%
% Last modified by charig-at-princeton.edu, 03/16/2016
% Last modified by mlubeck-at-email.arizona.edu, 03/18/2019
% Last modified by charig-at-email.arizona.edu, 03/16/2016
% Last modified by fjsimons-at-alum.mit.edu, 05/17/2011

% Determine parameters and set defaults
defval('Pcenter','CSR')
defval('Rlevel','RL05')
defval('Rlevel','RL06')
defval('units','SD')
defval('forcenew',1)

% Where the original data files are kept
defval('ddir1',fullfile(getenv('IFILES'),'GRACE','Originals',Rlevel,Pcenter));


% Where you would like to save the new .mat file
defval('ddir2',fullfile(getenv('IFILES'),'GRACE'));
% And the name of that save file
if strcmp(units,'SD')
fnpl=sprintf('%s/%s_%s_alldata_%s.mat',ddir2,Pcenter,Rlevel,units);
else
elseif strcmp(units,'POT')
fnpl=sprintf('%s/%s_%s_alldata.mat',ddir2,Pcenter,Rlevel);
else
error ('The unit input is not valid.')
end

% If this file already exists, load it. Otherwise, or if we force it, make
Expand All @@ -79,6 +86,12 @@
load(fnpl)
disp(sprintf('%s loaded by GRACE2PLMT',fnpl))
else
if ~exist(ddir1,'dir')
error ('The data you asked for are not currently stored.')
%If you received this error it means the directory datanames does
%not exist which means you have not downloaded the data or the data
%was not downloaded to where the program expects
end

% DATA CENTER
if strcmp(Pcenter,'GFZ')
Expand All @@ -105,16 +118,32 @@
datanames=ls2cell(fullfile(ddir1,'GSM*0060_0005'));
% CSR Release Level 5 has no calibrated error files
%errornames=ls2cell(fullfile(ddir1,'GSM*0060_0005.txt'));
elseif strcmp(Rlevel,'RL06')
datanames=ls2cell(fullfile(ddir1,'GSM*BA01_0600'));
%naming convention was changed for RL06 where BA stands
%for degree 60 gravity solution and 01 represents unconstrained
%spherical harmonic solution with a boxcar windowing function
%(the meaning of 01 was derived from the L-2 UserHandbook_v4.0).
%In addition, the BB stands for degree 96 gravity solution with a
%boxcar windowing function.
%The other change was made to the last naming entry, which is now
%in the form rrvv. In this case rr represents the release number
%maximum 2 digits and vv represents the maximum 2 digit version
%number. So for RL06 the nomenclature is 0600 instead of 0006 for
%Rl05 previosly. The PID naming convention stays the same.
end
% Know a priori what the bandwidth of the coefficients is
Ldata=60;
elseif strcmp(Pcenter,'JPL')
%Do we want to continue JPL support?
if strcmp(Rlevel,'RL05')
datanames=ls2cell(fullfile(ddir1,'GSM*JPLEM*0005'));
% JPL Release Level 5 has no calibrated error files
%errornames=ls2cell(fullfile(ddir1,'GSM*0060_0004.txt'));
else
error('JPL RL04 solutions not currently stored');
%elseif strcmp(Rlevel,'RL05');
% datanames=ls2cell(fullfile(ddir1,'GSM*JPLEM*005'));
end
% Know a priori what the bandwidth of the coefficients is
Ldata=90;
Expand All @@ -137,6 +166,9 @@
slrc20=load(fullfile(getenv('IFILES'),'SLR','C20_RL04_NH.txt'));
elseif strcmp(Rlevel,'RL05')
slrc20=load(fullfile(getenv('IFILES'),'SLR','C20_RL05_NH.txt'));
elseif strcmp(Rlevel,'RL06')
slrc20=load(fullfile(getenv('IFILES'),'SLR','C20_RL06_NH.txt'));

end
% The sigma error is column 4
slrc20_error=slrc20(:,4)*1e-10;
Expand All @@ -154,6 +186,11 @@
deg1=load(fullfile(getenv('IFILES'),'GRACE','deg1_RL04_NH.txt'));
elseif Rlevel=='RL05'
deg1=load(fullfile(getenv('IFILES'),'GRACE','deg1_RL05_NH.txt'));
elseif Rlevel=='RL06'
deg1=load(fullfile(getenv('IFILES'),'GRACE','deg1_RL05_NH.txt'));
%the RL06 deg 1 will be updated once the updated data has been
%released. For now the file being used is the updated RL05 one
%downloaded from the GRACE Tellus website
end
[n,m] = size(deg1);
dates_str = num2str(deg1(:,1));
Expand Down Expand Up @@ -290,7 +327,8 @@
%%%
% We have no calibrated errors for CSR release 05, so we have to bypass
% this section in this case.
if (strcmp(Pcenter,'CSR') || strcmp(Pcenter,'JPL')) && strcmp(Rlevel,'RL05')
if (strcmp(Pcenter,'CSR') || strcmp(Pcenter,'JPL')) && (strcmp(Rlevel,'RL05')...
|| strcmp(Rlevel,'RL06'))
cal_errors(index,:,:) = [lmcosi_month(:,1:2) zeros(size(lmcosi_month(:,1:2)))];
else
fname2=fullfile(ddir1,errornames{index});
Expand Down Expand Up @@ -401,4 +439,4 @@

% Collect output
varns={potcoffs,cal_errors,thedates};
varargout=varns(1:nargout);
varargout=varns(1:nargout);
21 changes: 13 additions & 8 deletions plm2pot.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
% Perhaps worth updating these for a more realistic, but
% still radial, mantle viscosity?
% Interpolate the elastic Love numbers to the bandwidth you need
[lkli,lkl]=lovenums('Wahr',el);
if wat == 4 || wat == 5
[lkli,lkl]=lovenums('Wahr',el);
end


switch wat
case 0 % Geoid (anomaly) (undulation)
Expand Down Expand Up @@ -127,7 +130,9 @@
elseif lmcosi(1)==1 && lmcosi(1,2)==0
lmcosi=[0 0 GMr 0 repmat(0,1,size(lmcosi,2)-4); % Degree 0
lmcosi]; % Then the rest
fact = [1 1; fact];
if ~wat == 0
fact = [1 1; fact];
end
end

switch wit
Expand Down Expand Up @@ -159,8 +164,8 @@
cb=colorbar('hor');
shrink(cb,1.5,2)
movev(cb,-0.05)
axes(cb)
set(get(cb,'xlabel'),'string','Surface density [kg/m^2]');
%axes(cb)
%set(get(cb,'xlabel'),'string','Surface density [kg/m^2]');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
axes(ah(2))
% Plot in mm
Expand All @@ -172,8 +177,8 @@
cb=colorbar('hor');
shrink(cb,1.5,2)
movev(cb,-0.05)
axes(cb)
set(get(cb,'xlabel'),'string','Geoid height variation [milimeters]');
%axes(cb)
%set(get(cb,'xlabel'),'string','Geoid height variation [milimeters]');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
axes(ah(3))
[data,ch,ph]=plotplm(lmcosiSD,[],[],4,1);
Expand All @@ -183,7 +188,7 @@
cb=colorbar('hor');
shrink(cb,1.5,2)
movev(cb,-0.05)
axes(cb)
set(get(cb,'xlabel'),'string','Surface density [kg/m^2]');
%axes(cb)
%set(get(cb,'xlabel'),'string','Surface density [kg/m^2]');
end

0 comments on commit 421b780

Please sign in to comment.