source: trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/res/mola_topo64/mola_buildSE.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.1 KB
Line 
1#! /usr/bin/octave -qf
2
3# -----------------------------------------------
4# mola_build.m                                 
5#   Script to be used with Matlab or GNU-Octave
6# -----------------------------------------------
7# Purpose:
8#   MOLA MEGDR binary file >> WRF geogrid tiles
9# Author:
10#   A. Spiga - 03/2007
11# -----------------------------------------------
12
13# Locate MOLA binary file
14filename = 'megt00n180gb.img';
15resolution = 32;
16
17# Read topographical data (MSB/big endian, 16-bits/2-bytes integer)
18f = fopen(filename,'r','ieee-be');
19el = fread(f,[360*resolution Inf],'int16')';
20
21# Get rid of negative values and flip North/South
22el = el + 9000;
23el = flipud(el);
24
25# Create 2 WRF data tiles for geogrid
26tile=180*resolution;
27        # Eastern part
28        part = el(1:1:tile,1:1:tile)';
29#
30#just have to change the names !
31#-- xrange - yrange
32        fid = fopen('00001-05760.00001-05760','wb','b');
33        fwrite(fid,part,'integer*2');
34
35        # Western part
36        part2 = el(1:1:tile,tile+1:1:2*tile)';
37        fid = fopen('05761-11520.00001-05760','wb','b');
38        fwrite(fid,part2,'integer*2');
39
40# Check the resulting arrays
41yeah = part(1:300:tile,1:300:tile);
42yeah2 = part2(1:300:tile,1:300:tile);
43contour(yeah)
44contour(yeah2)
Note: See TracBrowser for help on using the repository browser.