[Dart-dev] [4064] DART/trunk/models/POP: commiting the version of the test scripts etc . that work
nancy at ucar.edu
nancy at ucar.edu
Mon Sep 28 14:10:01 MDT 2009
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090928/c87d69ff/attachment.html
-------------- next part --------------
Modified: DART/trunk/models/POP/matlab/plot_global_grid.m
===================================================================
--- DART/trunk/models/POP/matlab/plot_global_grid.m 2009-09-24 17:56:47 UTC (rev 4063)
+++ DART/trunk/models/POP/matlab/plot_global_grid.m 2009-09-28 20:10:01 UTC (rev 4064)
@@ -1,6 +1,13 @@
-function plot_global_grid(n)
+function plot_global_grid(ugrid_file, tgrid_file)
% plot_global_grid
%
+% Example 1: plot the regular grid output
+%
+% ugrid_file = 'dipole_u_out_data';
+% tgrid_file = 'dipole_t_out_data';
+% plot_global_grid(ugrid_file, tgrid_file)
+%
+%
% plot_global_grid(1); % to plot regular grid output
% plot_global_grid(2); % to plot dipole x3 grid output
% plot_global_grid(3); % to plot regular grid with same grid as x3 in SH
@@ -16,37 +23,37 @@
% $Revision$
% $Date$
-if n == 1
- str0 = 'regular grid';
- u_out = load('regular_grid_u_out');
- t_out = load('regular_grid_t_out');
- nx = 111;
- ny = 317;
-elseif n == 2
- str0 = 'dipole grid';
- u_out = load('dipole_x3_u_out');
- t_out = load('dipole_x3_t_out');
- nx = 100;
- ny = 116;
-elseif n == 3
- str0 = 'regular grid in NH, dipole in SH';
- u_out = load('regular_griddi_u_out');
- t_out = load('regular_griddi_t_out');
- nx = 100;
- ny = 97;
+u = read_file(ugrid_file);
+t = read_file(tgrid_file);
+
+function chunk = read_file(fname)
+
+if (exist(fname,'file') ~=2 )
+ error('%s does not exist',fname)
end
-u = reshape(u_out(:,3),ny,nx);
-t = reshape(t_out(:,3),ny,nx);
+chunk.fname = fname;
+mydata = load(fname);
+chunk.lons = mydata(:,1);
+chunk.lats = mydata(:,2);
+chunk.vals = mydata(:,3);
+chunk.nx = sum(abs(diff(chunk.lats)) > 20) + 1; % looking for big jumps
+chunk.ny = length(chunk.lons) / chunk.nx;
+chunk.datmat = reshape(chunk.vals, chunk.ny, chunk.nx);
+chunk.string = sprintf('min/max is %f %f',min(chunk.vals), max(chunk.vals));
-str1 = sprintf('min/max is %f %f',min(u(:)), max(u(:)));
-str2 = sprintf('min/max is %f %f',min(t(:)), max(t(:)));
+figure;
-figure(1); clf
-imagesc(u); colorbar;
-title({'U Grid',str0,str1})
+% imagesc(chunk.lons, chunk.lats, chunk.datmat) ! dipole grids have lon(1) ~= 0
+imagesc(chunk.datmat)
+set(gca,'YDir','normal'); colorbar
+h = title({chunk.fname, chunk.string}); set(h,'Interpreter','none')
+xlabel(sprintf('%d longitudes',chunk.nx))
+ylabel(sprintf('%d latitudes',chunk.ny))
-figure(2); clf
-imagesc(t); colorbar;
-title({'T Grid',str0,str2})
+figure;
+h = plot(chunk.lons, chunk.lats,'.'); set(h,'MarkerSize',0.2)
+h = title(chunk.fname); set(h,'Interpreter','none')
+xlabel(sprintf('%d longitudes',chunk.nx))
+ylabel(sprintf('%d latitudes',chunk.ny))
Modified: DART/trunk/models/POP/matlab/plot_interp_diffs.m
===================================================================
--- DART/trunk/models/POP/matlab/plot_interp_diffs.m 2009-09-24 17:56:47 UTC (rev 4063)
+++ DART/trunk/models/POP/matlab/plot_interp_diffs.m 2009-09-28 20:10:01 UTC (rev 4064)
@@ -1,9 +1,24 @@
-function plot_interp_diffs(n)
+function plot_interp_diffs(ugrid_file, tgrid_file)
% plot_interp_diffs - script to examine the interpolation tests.
%
-% plot_interp_diffs(1) ; % difference regular grids
-% plot_interp_diffs(2) ; % difference dipole x3 grids
-% plot_interp_diffs(3) ; % regular grids with same grid as x3 in SH
+% Example 1: plot the regular grid output
+%--------------------------------------------------
+% ugrid_file = 'regular_grid_u_data';
+% tgrid_file = 'regular_grid_t_data';
+% plot_interp_diffs(ugrid_file, tgrid_file)
+%
+% Example 2: plot the dipole grid output
+%--------------------------------------------------
+% ugrid_file = 'dipole_grid_u_data';
+% tgrid_file = 'dipole_grid_t_data';
+% plot_interp_diffs(ugrid_file, tgrid_file)
+%
+% Example 3: plot the dipole grid output
+%--------------------------------------------------
+% ugrid_file = 'regular_griddi_u_data';
+% tgrid_file = 'regular_griddi_t_data';
+% plot_interp_diffs(ugrid_file, tgrid_file)
+%
% Data Assimilation Research Testbed -- DART
% Copyright 2004-2009, Data Assimilation Research Section
@@ -16,45 +31,16 @@
% $Revision$
% $Date$
-%n = input(['Input 1 to difference regular grids .\n' ...
-% 'Input 2 to difference dipole x3 grids . \n' ...
-% 'Input 3 to diffference regular grids with same grid as x3 in SH\n'])
+u_org = read_file(ugrid_file);
+t_org = read_file(tgrid_file);
+u_new = read_file(sprintf('%s.out',ugrid_file));
+t_new = read_file(sprintf('%s.out',tgrid_file));
-if n == 1
- u_data = load('regular_grid_u_data');
- t_data = load('regular_grid_t_data');
- u_out = load('regular_grid_u_out');
- t_out = load('regular_grid_t_out');
- nx = 111;
- ny = 317;
-elseif n == 2
- u_data = load('dipole_x3_u_data');
- t_data = load('dipole_x3_t_data');
- u_out = load('dipole_x3_u_out');
- t_out = load('dipole_x3_t_out');
- nx = 100;
- ny = 116;
-elseif n == 3
- u_data = load('regular_griddi_u_data');
- t_data = load('regular_griddi_t_data');
- u_out = load('regular_griddi_u_out');
- t_out = load('regular_griddi_t_out');
- nx = 100;
- ny = 97;
-else
- error('Sorry, choices are only 1, 2, or 3 ... you entered %d',n)
-end
+udif = u_org.datmat - u_new.datmat;
+tdif = t_org.datmat - t_new.datmat;
-u = reshape( u_out(:,3),ny,nx);
-ub = reshape(u_data(:,3),ny,nx);
-t = reshape( t_out(:,3),ny,nx);
-tb = reshape(t_data(:,3),ny,nx);
-
-dif = u - ub;
-tdif = t - tb;
-
-umin = min(dif(:));
-umax = max(dif(:));
+umin = min(udif(:));
+umax = max(udif(:));
str1 = sprintf('min/max of difference is %f %f',umin,umax);
tmin = min(tdif(:));
@@ -62,11 +48,29 @@
str2 = sprintf('min/max of difference is %f %f',tmin,tmax);
figure(1); clf;
-imagesc(dif)
+imagesc(udif); set(gca,'YDir','normal')
colorbar
title({'U Difference',str1})
figure(2); clf;
-imagesc(tdif)
+imagesc(tdif); set(gca,'YDir','normal')
colorbar
title({'T Difference',str2})
+
+
+function chunk = read_file(fname)
+
+if (exist(fname,'file') ~=2 )
+ error('%s does not exist',fname)
+end
+
+chunk.fname = fname;
+mydata = load(fname);
+chunk.lons = mydata(:,1);
+chunk.lats = mydata(:,2);
+chunk.vals = mydata(:,3);
+chunk.nx = sum(abs(diff(chunk.lats)) > 20) + 1; % looking for big jumps
+chunk.ny = length(chunk.lons) / chunk.nx;
+chunk.datmat = reshape(chunk.vals, chunk.ny, chunk.nx);
+chunk.string = sprintf('min/max is %f %f',min(chunk.vals), max(chunk.vals));
+
Modified: DART/trunk/models/POP/test_dipole_interp.f90
===================================================================
--- DART/trunk/models/POP/test_dipole_interp.f90 2009-09-24 17:56:47 UTC (rev 4063)
+++ DART/trunk/models/POP/test_dipole_interp.f90 2009-09-28 20:10:01 UTC (rev 4064)
@@ -1,5 +1,20 @@
program test_dipole_interp
+! I believe that I have done an initial test of the new interpolation
+! in the directory /fs/image/home/jla/DART_FIX_POP_INTERP/DART/models/POP/work
+! and that it worked successfully. I needed to copy some extra files from
+! my old test directories. I ran test_dipole_interp and selected option 2,
+! which interpolates from a regular grid to the dipolex3 (I think). I then
+! plotted the output with plot_global_grid.m and plot_globe_dif.m. The
+! results looked consistent with the results a obtained with the old interp
+! version on coral.
+!
+! We should definitely do additional clean-up on this testing case, and
+! possibly include a x1 test version, plus add a bit more documentation.
+!
+! Confirming my test on coral and then testing on blue_fire seems the
+! appropriate next steps.
+
use model_mod, only : test_interpolation
implicit none
@@ -9,17 +24,21 @@
write(*, *) 'Run test 1 followed by test 2'
write(*, *) ' test 3 followed by test 4'
write(*, *) ' or test 5 followed by test 6'
-
+write(*, *)
write(*, *) 'Test Case Menu'
-write(*, *) '1: regular grid -> dipole x3'
-write(*, *) '2: dipole x3 -> regular grid'
-write(*, *) '3: regular grid -> regular grid with same grid as x3 in SH'
-write(*, *) '4: regular grid with same grid as x3 in SH -> regular grid'
-write(*, *) '5: regular grid with same grid as x3 in SH -> dipole x3'
-write(*, *) '6: dipole x3 -> regular grid with same grid as x3 in SH'
write(*, *)
+write(*, *) '1: regular grid -> dipole grid'
+write(*, *) '2: dipole grid -> regular grid'
+write(*, *) '-------------------------------'
+write(*, *) '3: regular grid -> regular grid with same grid as dipole in SH'
+write(*, *) '4: regular grid with same grid as dipole in SH -> regular grid'
+write(*, *) '-------------------------------'
+write(*, *) '5: regular grid with same grid as dipole in SH -> dipole grid'
+write(*, *) '6: dipole grid -> regular grid with same grid as dipole in SH'
+write(*, *)
write(*, *) 'Select integer case'
read(*, *) test_casenum
+
call test_interpolation(test_casenum)
end program test_dipole_interp
Deleted: DART/trunk/models/POP/work/plot_global_grid.m
===================================================================
--- DART/trunk/models/POP/work/plot_global_grid.m 2009-09-24 17:56:47 UTC (rev 4063)
+++ DART/trunk/models/POP/work/plot_global_grid.m 2009-09-28 20:10:01 UTC (rev 4064)
@@ -1,49 +0,0 @@
-clear; close all
-
-n = input(['Input 1 to plot regular grid output.\n' ...
- 'Input 2 to plot dipole x3 grid output. \n' ...
- 'Input 3 to plot regular grid with same grid as x3 in SH\n'])
-
-
-if n == 1
- load regular_grid_u_out;
- u_out = regular_grid_u_out;
- load regular_grid_t_out;
- t_out = regular_grid_t_out;
- nx = 111;
- ny = 317;
-elseif n == 2
- load dipole_x3_u_out;
- u_out = dipole_x3_u_out;
- load dipole_x3_t_out;
- t_out = dipole_x3_t_out;
- nx = 100;
- ny = 116;
-elseif n == 3
- load regular_griddi_u_out;
- u_out = regular_griddi_u_out;
- load regular_griddi_t_out;
- t_out = regular_griddi_t_out;
- nx = 100;
- ny = 97;
-end
-
-index = 0;
-for i = 1:nx
- for j = 1:ny
- index = index + 1;
- u(i, j) = u_out(index, 3);
- t(i, j) = t_out(index, 3);
- end
-end
-
-figure(1)
-contour(u')
-title 'U Grid'
-
-figure(2)
-contour(t')
-title 'T Grid'
-
-
-
Deleted: DART/trunk/models/POP/work/plot_globe_dif.m
===================================================================
--- DART/trunk/models/POP/work/plot_globe_dif.m 2009-09-24 17:56:47 UTC (rev 4063)
+++ DART/trunk/models/POP/work/plot_globe_dif.m 2009-09-28 20:10:01 UTC (rev 4064)
@@ -1,69 +0,0 @@
-clear; close all
-
-n = input(['Input 1 to difference regular grids .\n' ...
- 'Input 2 to difference dipole x3 grids . \n' ...
- 'Input 3 to diffference regular grids with same grid as x3 in SH\n'])
-
-
-if n == 1
- load regular_grid_u_data;
- u_data = regular_grid_u_data;
- load regular_grid_t_data;
- t_data = regular_grid_t_data;
- load regular_grid_u_out;
- u_out = regular_grid_u_out;
- load regular_grid_t_out;
- t_out = regular_grid_t_out;
- nx = 111;
- ny = 317;
-elseif n == 2
- load dipole_x3_u_data;
- u_data = dipole_x3_u_data;
- load dipole_x3_t_data;
- t_data = dipole_x3_t_data;
- load dipole_x3_u_out;
- u_out = dipole_x3_u_out;
- load dipole_x3_t_out;
- t_out = dipole_x3_t_out;
- nx = 100;
- ny = 116;
-elseif n == 3
- load regular_griddi_u_data;
- u_data = regular_griddi_u_data;
- load regular_griddi_t_data;
- t_data = regular_griddi_t_data;
- load regular_griddi_u_out;
- u_out = regular_griddi_u_out;
- load regular_griddi_t_out;
- t_out = regular_griddi_t_out;
- nx = 100;
- ny = 97;
-end
-
-
-index = 0;
-for i = 1:nx
- for j = 1:ny
- index = index + 1;
- u(i, j) = u_out(index, 3);
- ub(i, j) = u_data(index, 3);
- dif(i, j) = u(i, j) - ub(i, j);
- t(i, j) = t_out(index, 3);
- tb(i, j) = t_data(index, 3);
- tdif(i, j) = t(i, j) - tb(i, j);
- end
-end
-
-figure(1)
-contour(dif', 20)
-colorbar
-title 'U Difference'
-
-figure(2)
-contour(tdif', 20)
-colorbar
-title 'T Difference'
-
-
-
-
More information about the Dart-dev
mailing list