source: trunk/MESOSCALE/LMD_MM_MARS/WPS_GEOG/res/albedo_TES/tesalbedo_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.1 KB
Line 
1#! /usr/bin/octave -qf
2
3# -----------------------------------------------
4# tesalbedo_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 = 'global_albedo_8ppd.img';
15resolution = 8;
16
17# Read topographical data (PC_REAL, 32-bits/4-bytes float)
18f = fopen(filename,'r','ieee-le');
19el = fread(f,[360*resolution Inf],'float32')';
20
21# Flip North/South
22el = flipud(el);
23# Scale factor (ie accuracy): 10000
24el = 10000.*el;
25# Conversion float >> integer
26el = round(el);
27
28# Create 2 WRF data tiles for geogrid
29tile=180*resolution;
30        # Eastern part
31        part = el(1:1:tile,1:1:tile)';
32        fid = fopen('00001-01440.00001-01440','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('01441-02880.00001-01440','wb','b');
38        fwrite(fid,part2,'integer*2');
39
40# Check the resulting arrays
41yeah = part(1:10:tile,1:10:tile);
42yeah2 = part2(1:10:tile,1:10:tile);
43contour(yeah)
44contour(yeah2)
45
Note: See TracBrowser for help on using the repository browser.