source: trunk/MESOSCALE/PLOT/SPEC/getget.pro @ 205

Last change on this file since 205 was 86, checked in by aslmd, 14 years ago

*
mars + LMD_MM_MARS
* Precompilation flag MESOSCALE for better transparency

* in shared phymars between GCM and mesoscale model

*

M 85 mars/libf/phymars/meso_physiq.F
M 85 mars/libf/phymars/meso_inifis.F
Added a pre-compilation flag MESOSCALE so that the LMDZ.MARS GCM
will compile without stating errors because of mesoscale routines.

M 85 mars/libf/phymars/newcondens.F
M 85 mars/libf/phymars/testphys1d.F
M 85 mars/libf/phymars/dustlift.F
D 85 mars/libf/phymars/meso_testphys1d.F
D 85 mars/libf/phymars/meso_dustlift.F
D 85 mars/libf/phymars/meso_newcondens.F
Now, this MESOSCALE precompilation flag can be used to lower
the number of meso_* routines when adaptations for mesoscale
applications are not very extended.
--> Three meso_* routines were deleted and changes are
now impacted under the MESOSCALE flag in the original GCM routines
--> Completely transparent for GCM compilation since it is devoid
of the -DMESOSCALE option
--> Very good for syncing because changes in dustlift, newcondens
will be directly available in the mesoscale model

M 84 mesoscale/LMD_MM_MARS/makemeso
Changed meso_testphys1d in testphys1d

M 84 mesoscale/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/makegcm_pgf
M 84 mesoscale/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/makegcm_mpifort
M 84 mesoscale/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/makegcm_ifort
M 84 mesoscale/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/makegcm_g95
M 84 mesoscale/LMD_MM_MARS/SRC/WRFV2/mars_lmd_new/makegcm_mpi
Added the option -DMESOSCALE in these scripts

*
LMD_MM_MARS
* Various minor changes related to water cycle and plotting routines

* Also included the GW test case

*

A 0 mesoscale/LMDZ.MARS.new/myGCM/DEFS_JB/callphys.def.orig
M 84 mesoscale/NOTES.txt
D 84 mesoscale/LMD_MM_MARS/SRC/ARWpost/idl
M 84 mesoscale/LMD_MM_MARS/SRC/WRFV2/Registry/Registry.EM
M 84 mesoscale/LMD_MM_MARS/SIMU/gnome_launch.meso
M 85 mesoscale/PLOT/MINIMAL/map_latlon.pro
D 85 mesoscale/PLOT/SPEC/LES/getget.pro
M 85 mesoscale/PLOT/SPEC/MAP/map_uvt.pro
A + - mesoscale/PLOT/SPEC/getget.pro
A 0 mesoscale/PLOT/RESERVE/obsolete
A 0 mesoscale/TESTS/TESTGW.tar.gz
M 84 000-USERS

File size: 3.3 KB
Line 
1function getget, name, charvar, count=count, offset=offset, stride=stride, coordmean=coordmean, anomaly=anomaly
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3; name: char
4; charvar: char
5; count: 4 elements array   ; The dimensions of the sub-image
6; offset: 4 elements array  ; A variable that contains the offset for the sub-image
7; stride: 4 elements array  ; Create a variable to be used as a value for the STRIDE keyword
8; coordmean: 1 to 4 elements array (dimension 1 is 1)
9; anomaly: a non-null element that would be filled with mean
10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11
12
13;print, charvar
14
15
16nosave = 1  ;; comment to get an IDL data file
17notime = 1  ;; comment to get mention of time taken
18if (n_elements(notime) eq 0) then timetime = SYSTIME(1)
19
20;
21; MINIMAL ARGUMENTS
22;
23if (n_elements(name) eq 0) then stop
24if (n_elements(charvar) eq 0) then stop
25
26;
27; IDL DATA DIRECTORY
28;
29name_idl = charvar+name+'.idl'
30  if (n_elements(coordmean) ne 0) then begin
31    nc = n_elements(coordmean)
32    for i=0,nc-1 do begin
33     name_idl = string(coordmean(i),'(I0)')+name_idl   
34    endfor
35  endif
36name_idl = './idl_dat/'+name_idl
37
38;
39; TEST IF FILE EXISTS
40;
41openr,unit,name_idl,/get_lun,error=err
42
43;
44; IF IDL FILE EXISTS, THAT IS RATHER SIMPLE
45;
46IF (err EQ 0) THEN BEGIN
47
48   print, 'read from file'
49   free_lun,unit
50   restore, filename=name_idl
51
52;
53; IF IDL FILE DOES NOT EXIST, WELL, READ NETCDF
54;
55ENDIF ELSE BEGIN
56
57  ;
58  ; check save directory
59  ;
60  if (n_elements(nosave) eq 0) then SPAWN, 'mkdir -p idl_dat' 
61
62  ;
63  ; open file
64  ;
65  id=ncdf_open(name)
66
67  ;
68  ; get dimensions
69  ;
70  var = intarr(4)
71  NCDF_DIMINQ, id, NCDF_DIMID(id, 'west_east'    ), toto, titi & var(0) = titi
72  NCDF_DIMINQ, id, NCDF_DIMID(id, 'south_north'  ), toto, titi & var(1) = titi
73  NCDF_DIMINQ, id, NCDF_DIMID(id, 'bottom_top'   ), toto, titi & var(2) = titi
74  NCDF_DIMINQ, id, NCDF_DIMID(id, 'Time'         ), toto, titi & var(3) = titi
75  ;print, var
76
77  ;
78  ; define default data windows
79  ;
80  if (n_elements(offset) le 3) then offset=[0,0,0,0]
81  if (n_elements(stride) le 3) then stride=[1,1,1,1]
82  if (n_elements(count) le 3) then count=intarr(4)
83  w = where(count eq 0) & if (w(0) ne -1) then count[w] = var[w] / stride[w]
84
85  ;
86  ; read variable
87  ;
88  varid=ncdf_varid(id,charvar) ;& print, 'get '+charvar
89  if (n_elements(notime) eq 0) then timetime = SYSTIME(1) ;& help, /memory
90  ncdf_varget, id, varid, invar, count=count, offset=offset, stride=stride & if (n_elements(notime) eq 0) then print, SYSTIME(1) - timetime, ' s' ;& help, /memory
91  ncdf_close, id
92
93  ;
94  ; OPTIONAL: ANOMALY (value is returned in the keyword)
95  ;
96  if (n_elements(anomaly) ne 0) then begin
97    anomaly=TOTAL(TOTAL(invar,1),1)/float(var[0])/float(var[1])
98    for i=0,var[0]-1 do for j=0,var[1]-1 do invar(i,j,*,*) = TEMPORARY(invar(i,j,*,*)) - anomaly  ; coute cher ; pas tant
99  endif
100
101  ;
102  ; OPTIONAL: MEAN
103  ;
104  if (n_elements(coordmean) ne 0) then begin
105  for i=0,nc-1 do begin
106   print, 'mean over dimension '+string(coordmean(i),'(I0)')+' - '+string(var(coordmean(i)),'(I0)')+' elements'
107   invar=total(TEMPORARY(invar),coordmean(i))/var(coordmean(i))
108  endfor
109  endif
110
111  ;
112  ; SAVE
113  ;
114  if (n_elements(nosave) eq 0) then save, invar, filename=name_idl
115
116ENDELSE
117
118if (n_elements(notime) eq 0) then print, SYSTIME(1) - timetime, ' s'
119
120;
121; RETURN FIELD
122;
123return, invar
124
125end
Note: See TracBrowser for help on using the repository browser.