source: trunk/src/testInterp2D.m @ 327

Last change on this file since 327 was 327, checked in by pinsard, 13 years ago

change svn properties

  • Property svn:keywords set to URL
File size: 2.0 KB
Line 
1%+
2%
3% .. _testInterp2D.m:
4%
5% ==============
6% testInterp2D.m
7% ==============
8%
9% DESCRIPTION
10% ===========
11%
12% EVOLUTIONS
13% ==========
14%
15% $Id$
16%
17% $URL$
18%
19% - fplod 20110705T125628Z cratos.locean-ipsl.upmc.fr (Linux)
20%
21%   * minimal header
22%
23%-
24latmin = 10;
25latmax = 20;
26lonmin = -20;
27lonmax = -10;
28
29filename='msg-tb108_2006-07-27_15min.nc';
30
31repertoire = 'C:\Users\Jas\Desktop\Documents de Travail\S6\Stage au labo LOCEAN\Matlab\MSG\';
32path(path,repertoire);
33
34ncid = netcdf.open(filename, 'NC_NOWRITE');
35Temps = netcdf.getVar(ncid,3);
36Longitudes = netcdf.getVar(ncid,1);
37Latitudes = netcdf.getVar(ncid,2);
38
39startlat = find(Latitudes>=latmin, 1 );
40countlat = find(Latitudes<=latmax, 1, 'last' ) - startlat +1;
41startlon = find(Longitudes>=lonmin, 1 );
42countlon = find(Longitudes<=lonmax, 1, 'last' ) - startlon +1;
43
44Latitudes = Latitudes(Latitudes>=latmin & Latitudes<=latmax);
45Longitudes = Longitudes(Longitudes>=lonmin & Longitudes<=lonmax);
46
47TbMSG = netcdf.getVar(ncid,0,[startlon-1 startlat-1 0],...
48    [countlon countlat size(Temps,1)]);
49
50TbMSG = TbMSG*0.01+327.68;
51
52ij_TbMoy = mean(TbMSG,3);
53
54xi = 1 : (size(ij_TbMoy,1)-1)/99 : size(ij_TbMoy,1);
55yi = (1 : (size(ij_TbMoy,2)-1)/99 : size(ij_TbMoy,2))';
56
57ij_TbMoy_interp = interp2(ij_TbMoy,xi,yi);
58
59load coast
60
61set(gcf,'color','w','units','normalized','position',[0 0 1 1]);
62subplot(1,2,1);
63image = imagesc(Longitudes,Latitudes,ij_TbMoy');
64set(image,'alphadata',~isnan(ij_TbMoy'));
65axis([lonmin lonmax latmin latmax])
66hold on
67set(gca,'ydir','normal')
68coast = plot(long,lat,'k-');
69Title = title('Données originelles');
70xlabel('Longitudes')
71ylabel('Latitudes')
72grid on
73ticklatlon
74
75subplot(1,2,2);
76image2 = imagesc(Longitudes,Latitudes,ij_TbMoy_interp');
77set(image2,'alphadata',~isnan(ij_TbMoy_interp'));
78axis([lonmin lonmax latmin latmax])
79hold on
80set(gca,'ydir','normal')
81coast2 = plot(long,lat,'k-');
82Title2 = title('Données interpolées');
83xlabel('Longitudes')
84ylabel('Latitudes')
85grid on
86ticklatlon
Note: See TracBrowser for help on using the repository browser.