source: trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/thermal_GCM/thermal_build.m

Last change on this file was 11, checked in by aslmd, 14 years ago

spiga@svn-planeto:ajoute le modele meso-echelle martien

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#! /usr/bin/octave -qf
2
3# -----------------------------------------------
4# thermal_build.m                                       
5#   Script to be used with GNU-Octave
6#   > For NETCDF support, get 'octave-forge' pckg octcdf (install headers)
7#   and install it in octave with 'pkg install octcdf-1.0.11.tar.gz'
8#   (you also need libnetcdf-dev)
9# -----------------------------------------------
10# Purpose:
11#   Thermal inertia GCM NETCDF input
12#       >> WRF geogrid tiles
13# Author:
14#   A. Spiga - 03/2007
15# -----------------------------------------------
16
17# Locate NETCDF file
18filename = 'surface.nc';
19resolution = 180;
20
21# Open NETCDF file - read-only
22nc = netcdf('surface.nc','r')
23
24# Read ...
25# Thermal inertia
26nv = ncvar(nc){4};
27thermal = nv(:);
28size(thermal)
29
30# Flip North/South
31thermal = flipud(thermal);
32#thermal = fliplr(thermal);
33
34# Create 2 WRF data tiles for geogrid
35tile=resolution;
36        # Eastern part
37        part = thermal(1:1:tile,1:1:tile)';
38        #fid = fopen('00181-00360.00001-00180','wb','b');
39        fid = fopen('00001-00180.00001-00180','wb','b');
40        fwrite(fid,part,'integer*2');
41
42        # Western part
43        part2 = thermal(1:1:tile,tile+1:1:2*tile)';
44        #fid = fopen('00001-00180.00001-00180','wb','b');
45        fid = fopen('00181-00360.00001-00180','wb','b');
46        fwrite(fid,part2,'integer*2');
47
48# Check the resulting arrays
49yeah = part(1:1:tile,1:1:tile);
50yeah2 = part2(1:1:tile,1:1:tile);
51contour(yeah)
52contour(yeah2)
Note: See TracBrowser for help on using the repository browser.