Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Oct 26, 2022
1 parent 7b1e7a1 commit cc13997
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 145 deletions.
12 changes: 6 additions & 6 deletions +gemini3d/+efield/Efield_BCs.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ function Efield_BCs(p, xg)
end
end

thetamin = min(xg.theta(:));
thetamax = max(xg.theta(:));
mlatmin = 90-thetamax*180/pi;
mlatmax = 90-thetamin*180/pi;
mlonmin = min(xg.phi(:))*180/pi;
mlonmax = max(xg.phi(:))*180/pi;
thetamin = min(xg.theta, [], 'all');
thetamax = max(xg.theta, [], 'all');
mlatmin = 90- rad2deg(thetamax);
mlatmax = 90- rad2deg(thetamin);
mlonmin = rad2deg(min(xg.phi, [], 'all'));
mlonmax = rad2deg(max(xg.phi, [], 'all'));

% add a 1% buff
latbuf = 1/100 * (mlatmax-mlatmin);
Expand Down
10 changes: 5 additions & 5 deletions +gemini3d/+grid/model2geocoords.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
lalt (1,1) {mustBePositive,mustBeInteger} = 150
llon (1,1) {mustBePositive,mustBeInteger} = 150
llat (1,1) {mustBePositive,mustBeInteger} = 150
altlims (1,2) {mustBeReal} = [min(xg.alt, 'all')+0.0001, max(xg.alt, 'all')-0.0001]
altlims (1,2) {mustBeReal} = [min(xg.alt, [], 'all')+0.0001, max(xg.alt, [], 'all')-0.0001]
glonlims (1,2) {mustBeReal} = [nan,nan]
glatlims (1,2) {mustBeReal} = [nan,nan]
end
Expand Down Expand Up @@ -36,10 +36,10 @@
%end %if

if any(isnan(glonlims))
glonlims=[min(double(glon(:))), max(double(glon(:)))];
glonlims=[min(glon, [], 'all'), max(glon, [], 'all')];
end
if any(isnan(glatlims))
glatlims=[min(double(glat(:))), max(double(glat(:)))];
glatlims=[min(glat, [], 'all'), max(glat, [], 'all')];
end

%% Define a regular mesh of a set number of points that encompasses the grid (or part of the grid)
Expand All @@ -50,8 +50,8 @@


%% Identify the type of grid that we are using
minh1=min(xg.h1(:));
maxh1=max(xg.h1(:));
minh1=min(xg.h1, [], 'all');
maxh1=max(xg.h1, [], 'all');
if (abs(minh1-1)>1e-4 || abs(maxh1-1)>1e-4) %curvilinear grid
flagcurv=1;
else %cartesian grid
Expand Down
10 changes: 5 additions & 5 deletions +gemini3d/+grid/model2magUENcoords.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
lz=150; lx=150; ly=150;
end %if
if (nargin<8) %default to using grid limits if not given
zlims=[min(zUEN(:))+1,max(zUEN(:))-1]; %stay just inside given grid
xlims=[min(xUEN(:))+1,max(xUEN(:))-1];
ylims=[min(yUEN(:))+1,max(yUEN(:))-1];
zlims=[min(zUEN, [], 'all')+1,max(zUEN, [], 'all')-1]; %stay just inside given grid
xlims=[min(xUEN, [], 'all')+1,max(xUEN, [], 'all')-1];
ylims=[min(yUEN, [], 'all')+1,max(yUEN, [], 'all')-1];
end %if


Expand All @@ -37,8 +37,8 @@


%% Identify the type of grid that we are using
minh1=min(xg.h1(:));
maxh1=max(xg.h1(:));
minh1=min(xg.h1, [], 'all');
maxh1=max(xg.h1, [], 'all');
if (abs(minh1-1)>1e-4 || abs(maxh1-1)>1e-4) %curvilinear grid
flagcurv=1;
else %cartesian grid
Expand Down
6 changes: 3 additions & 3 deletions +gemini3d/+grid/model2magcoords.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
lalt (1,1) {mustBePositive,mustBeInteger} = 150
llon (1,1) {mustBePositive,mustBeInteger} = 150
llat (1,1) {mustBePositive,mustBeInteger} = 150
altlims (1,2) {mustBeReal} = [min(xg.alt, 'all')+0.0001, max(xg.alt, 'all')-0.0001]
altlims (1,2) {mustBeReal} = [min(xg.alt, [], 'all')+0.0001, max(xg.alt, [], 'all')-0.0001]
mlonlims (1,2) {mustBeReal} = [nan,nan]
mlatlims (1,2) {mustBeReal} = [nan,nan]
end
Expand All @@ -27,11 +27,11 @@
x1=xg.x1(inds1); x2=xg.x2(inds2); x3=xg.x3(inds3);

if any(isnan(mlonlims))
mlonlims=[min(mlon, 'all')+0.0001, max(mlon, 'all')-0.0001];
mlonlims=[min(mlon, [], 'all')+0.0001, max(mlon, [], 'all')-0.0001];
end

if any(isnan(mlatlims))
mlatlims=[min(mlat, 'all')+0.0001, max(mlat, 'all')-0.0001];
mlatlims=[min(mlat, [], 'all')+0.0001, max(mlat, [], 'all')-0.0001];
end %if


Expand Down
4 changes: 2 additions & 2 deletions +gemini3d/+model/magcalc.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function magcalc(direc, dang, xg)

%TABULATE THE SOURCE OR GRID CENTER LOCATION
if isempty(cfg.sourcemlon)
thdist=mean(xg.theta(:));
phidist=mean(xg.phi(:));
thdist=mean(xg.theta, 'all');
phidist=mean(xg.phi, 'all');
else
thdist= pi/2 - deg2rad(cfg.sourcemlat); %zenith angle of source location
phidist= deg2rad(cfg.sourcemlon);
Expand Down
12 changes: 6 additions & 6 deletions +gemini3d/+particles/grid.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
pg.Qit = zeros(pg.llon, pg.llat, Nt);
pg.E0it = nan(pg.llon, pg.llat, Nt);

thetamin = min(xg.theta(:));
thetamax = max(xg.theta(:));
mlatmin = 90-thetamax*180/pi;
mlatmax = 90-thetamin*180/pi;
mlonmin = min(xg.phi(:))*180/pi;
mlonmax = max(xg.phi(:))*180/pi;
thetamin = min(xg.theta, [], 'all');
thetamax = max(xg.theta, [], 'all');
mlatmin = 90- rad2deg(thetamax);
mlatmax = 90- rad2deg(thetamin);
mlonmin = rad2deg(min(xg.phi, [], 'all'));
mlonmax = rad2deg(max(xg.phi, [], 'all'));

% add a 1% buffer
latbuf = 1/100*(mlatmax-mlatmin);
Expand Down
16 changes: 8 additions & 8 deletions +gemini3d/+plot/cart2d.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ function cart2d(time,xg,parm,parmlbl,caxlims,sourceloc, h, cmap)


%SIZE OF PLOT GRID THAT WE ARE INTERPOLATING ONTO
meantheta=mean(xg.theta(:));
%meanphi=mean(xg.phi(:));
meantheta=mean(xg.theta, 'all');
%meanphi=mean(xg.phi, 'all');
y=-1*(xg.theta-meantheta); %this is a mag colat. coordinate and is only used for defining grid in linspaces below, runs backward from north distance, hence the negative sign
%x=(xg.phi-meanphi); %mag. lon coordinate, pos. eastward
x=xg.x2(inds2)/Re/sin(meantheta);
z=xg.alt;
lxp=500;
lyp=500;
lzp=500;
minx=min(x(:));
maxx=max(x(:));
miny=min(y(:));
maxy=max(y(:));
minz=min(z(:));
maxz=max(z(:));
minx=min(x, [], 'all');
maxx=max(x, [], 'all');
miny=min(y, [], 'all');
maxy=max(y, [], 'all');
minz=min(z, [], 'all');
maxz=max(z, [], 'all');
xp=linspace(minx,maxx,lxp); %eastward distance (rads.)
yp=linspace(miny,maxy,lyp); %should be interpreted as northward distance (in rads.). Irrespective of ordering of xg.theta, this will be monotonic increasing!!!
zp=linspace(minz,maxz,lzp)'; %altitude (meters)
Expand Down
30 changes: 15 additions & 15 deletions +gemini3d/+plot/cart3d_long.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ function cart3d_long(time, xg, parm, parmlbl, caxlims, sourceloc, hf, cmap)
plotparams.altref=110;

%% SIZE OF PLOT GRID THAT WE ARE INTERPOLATING ONTO
meantheta=mean(xg.theta(:));
meanphi=mean(xg.phi(:));
meantheta=mean(xg.theta, 'all');
meanphi=mean(xg.phi, 'all');
y=-1*(xg.theta-meantheta); %this is a mag colat. coordinate and is only used for defining grid in linspaces below, runs backward from north distance, hence the negative sign
x=(xg.phi-meanphi); %mag. lon coordinate, pos. eastward
z=xg.alt/1e3;
lxp=500;
lyp=500;
lzp=500;
minx=min(x(:));
maxx=max(x(:));
miny=min(y(:));
maxy=max(y(:));
minz=min(z(:));
maxz=max(z(:));
minx=min(x, [], 'all');
maxx=max(x, [], 'all');
miny=min(y, [], 'all');
maxy=max(y, [], 'all');
minz=min(z, [], 'all');
maxz=max(z, [], 'all');
xp=linspace(minx,maxx,lxp); %eastward distance (rads.)
yp=linspace(miny,maxy,lyp); %should be interpreted as northward distance (in rads.). Irrespective of ordering of xg.theta, this will be monotonic increasing!!!
zp=linspace(minz,maxz,lzp)'; %altitude (meters)
Expand All @@ -68,23 +68,23 @@ function cart3d_long(time, xg, parm, parmlbl, caxlims, sourceloc, hf, cmap)
%ix1s=floor(lx1/2):lx1; %only valide for a grid which is symmetric aboutu magnetic equator... (I think)
ix1s=find(xg.x1(inds1)>=0); %works for asymmetric grids
minz=0;
maxz=max(xg.alt(:));
maxz=max(xg.alt, [], 'all');
[tmp,ix1]=min(abs(xg.alt(ix1s,1,1)-maxz*1e3));
ix1=ix1s(ix1);
thetavals=xg.theta(ix1:lx1,:,:);
meantheta=mean(thetavals(:));
meantheta=mean(thetavals, 'all');
phivals=xg.phi(ix1:lx1,:,:);
meanphi=mean(phivals(:));
meanphi=mean(phivals, 'all');
x=(thetavals-meantheta); %this is a mag colat. coordinate and is only used for defining grid in linspaces below and the parametric surfaces in the plots
y=(phivals-meanphi); %mag. lon coordinate
z=xg.alt(ix1:lx1,:,:)/1e3; %altitude
lxp=500;
lyp=500;
lzp=500;
minx=min(x(:));
maxx=max(x(:));%+0.5*(max(x(:))-min(x(:)));
miny=min(y(:));
maxy=max(y(:));
minx=min(x, [], 'all');
maxx=max(x, [], 'all');%+0.5*(max(x, [], 'all')-min(x, [], 'all'));
miny=min(y, [], 'all');
maxy=max(y, [], 'all');
xp=linspace(minx,maxx,lxp);
yp=linspace(miny,maxy,lyp);
zp=linspace(minz,maxz,lzp)';
Expand Down
30 changes: 15 additions & 15 deletions +gemini3d/+plot/cart3d_long_enu.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ function cart3d_long_enu(time,xg,parm,parmlbl,caxlims,sourceloc,hf,cmap)
plotparams.altref=300;

%% SIZE OF PLOT GRID THAT WE ARE INTERPOLATING ONTO
meantheta=mean(xg.theta(:));
%meanphi=mean(xg.phi(:));
meantheta=mean(xg.theta, 'all');
%meanphi=mean(xg.phi, 'all');
y=-1*(xg.theta-meantheta); %this is a mag colat. coordinate and is only used for defining grid in linspaces below, runs backward from north distance, hence the negative sign
%x=(xg.phi-meanphi); %mag. lon coordinate, pos. eastward
x=xg.x2(inds2)/Re/sin(meantheta);
z=xg.alt/1e3;
lxp=500;
lyp=500;
lzp=500;
minx=min(x(:));
maxx=max(x(:));
miny=min(y(:));
maxy=max(y(:));
minz=min(z(:));
maxz=max(z(:));
minx=min(x, [], 'all');
maxx=max(x, [], 'all');
miny=min(y, [], 'all');
maxy=max(y, [], 'all');
minz=min(z, [], 'all');
maxz=max(z, [], 'all');
xp=linspace(minx,maxx,lxp); %eastward distance (rads.)
yp=linspace(miny,maxy,lyp); %should be interpreted as northward distance (in rads.). Irrespective of ordering of xg.theta, this will be monotonic increasing!!!
zp=linspace(minz,maxz,lzp)'; %altitude (kilometers)
Expand All @@ -69,23 +69,23 @@ function cart3d_long_enu(time,xg,parm,parmlbl,caxlims,sourceloc,hf,cmap)
%ix1s=floor(lx1/2):lx1; %only valide for a grid which is symmetric aboutu magnetic equator... (I think)
ix1s=find(xg.x1(inds1)>=0); %works for asymmetric grids
minz=0;
maxz=max(xg.alt(:));
maxz=max(xg.alt, [], 'all');
[tmp,ix1]=min(abs(xg.alt(ix1s,1,1)-maxz*1e3));
ix1=ix1s(ix1);
thetavals=xg.theta(ix1:lx1,:,:);
meantheta=mean(thetavals(:));
meantheta=mean(thetavals, 'all');
phivals=xg.phi(ix1:lx1,:,:);
meanphi=mean(phivals(:));
meanphi=mean(phivals, 'all');
x=(thetavals-meantheta); %this is a mag colat. coordinate and is only used for defining grid in linspaces below and the parametric surfaces in the plots
y=(phivals-meanphi); %mag. lon coordinate
z=xg.alt(ix1:lx1,:,:)/1e3; %altitude
lxp=500;
lyp=500;
lzp=500;
minx=min(x(:));
maxx=max(x(:));%+0.5*(max(x(:))-min(x(:)));
miny=min(y(:));
maxy=max(y(:));
minx=min(x, [], 'all');
maxx=max(x, [], 'all');%+0.5*(max(x, [], 'all')-min(x, [], 'all'));
miny=min(y, [], 'all');
maxy=max(y, [], 'all');
xp=linspace(minx,maxx,lxp);
yp=linspace(miny,maxy,lyp);
zp=linspace(minz,maxz,lzp)';
Expand Down
32 changes: 16 additions & 16 deletions +gemini3d/+plot/curv2d.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function curv2d(time,xg,parm,parmlbl,caxlims, sourceloc, h, cmap)
sourcemlat=sourceloc(1);
%sourcemlon=sourceloc(2);
else
sourcemlat=mean(90-xg.theta(:)*180/pi); %just take avg. over the grid
sourcemlat=mean(90-rad2deg(xg.theta), 'all'); %just take avg. over the grid
end %if


Expand All @@ -45,22 +45,22 @@ function curv2d(time,xg,parm,parmlbl,caxlims, sourceloc, h, cmap)


%SIZE OF PLOT GRID THAT WE ARE INTERPOLATING ONTO
meantheta=mean(xg.theta(:));
%meanphi=mean(xg.phi(:));
meantheta=mean(xg.theta, 'all');
%meanphi=mean(xg.phi, 'all');
%meanphi=xg.x3(inds3(1)); %dont' forget that x3 has ghost cells!!!
x=(xg.theta-meantheta); %this is a mag colat. coordinate and is only used for defining grid in linspaces below
%y=(xg.phi-meanphi); %mag. lon coordinate
z=xg.alt/1e3;
lxp=1500;
%lyp=500;
lzp=1500;
minx=min(x(:));
maxx=max(x(:));
%miny=min(y(:));
%maxy=max(y(:));
%minz=min(z(:));
minx=min(x, [], 'all');
maxx=max(x, [], 'all');
%miny=min(y, [], 'all');
%maxy=max(y, [], 'all');
%minz=min(z, [], 'all');
minz=0;
maxz=max(z(:));
maxz=max(z, [], 'all');
xp=linspace(minx,maxx,lxp);
%yp=linspace(miny,maxy,lyp);
zp=linspace(minz,maxz,lzp)';
Expand All @@ -69,23 +69,23 @@ function curv2d(time,xg,parm,parmlbl,caxlims, sourceloc, h, cmap)
%ix1s=floor(lx1/2):lx1; %only valide for a grid which is symmetric aboutu magnetic equator... (I think)
ix1s=find(xg.x1(inds1)>=0); %works for asymmetric grids
minz=0;
maxz=max(xg.alt(:));
maxz=max(xg.alt, [], 'all');
[tmp,ix1]=min(abs(xg.alt(ix1s,1,1)-maxz*1e3));
ix1=ix1s(ix1);
thetavals=xg.theta(ix1:lx1,:,:);
meantheta=mean(thetavals(:));
meantheta=mean(thetavals, 'all');
phivals=xg.phi(ix1:lx1,:,:);
meanphi=mean(phivals(:));
meanphi=mean(phivals, 'all');
x=(thetavals-meantheta); %this is a mag colat. coordinate and is only used for defining grid in linspaces below and the parametric surfaces in the plots
y=(phivals-meanphi); %mag. lon coordinate
z=xg.alt(ix1:lx1,:,:)/1e3; %altitude
lxp=500;
lyp=500;
lzp=500;
minx=min(x(:));
maxx=max(x(:));%+0.5*(max(x(:))-min(x(:)));
miny=min(y(:));
maxy=max(y(:));
minx=min(x, [], 'all');
maxx=max(x, [], 'all');%+0.5*(max(x, [], 'all')-min(x, [], 'all'));
miny=min(y, [], 'all');
maxy=max(y, [], 'all');
xp=linspace(minx,maxx,lxp);
yp=linspace(miny,maxy,lyp);
zp=linspace(minz,maxz,lzp)';
Expand Down
Loading

0 comments on commit cc13997

Please sign in to comment.