source: TOOLS/MOSAIX/CalvingWeights.py @ 4159

Last change on this file since 4159 was 4159, checked in by omamce, 6 years ago

O.M. : correct eORC025 case for calving weights

  • Property svn:keywords set to Date Revision HeadURL Author Id
File size: 20.4 KB
Line 
1### ===========================================================================
2###
3### Compute calving weights.
4###
5### ===========================================================================
6##
7##  Warning, to install, configure, run, use any of Olivier Marti's
8##  software or to read the associated documentation you'll need at least
9##  one (1) brain in a reasonably working order. Lack of this implement
10##  will void any warranties (either express or implied).
11##  O. Marti assumes no responsability for errors, omissions,
12##  data loss, or any other consequences caused directly or indirectly by
13##  the usage of his software by incorrectly or partially configured
14##  personal.
15##
16import netCDF4, numpy as np
17import sys, os, platform, argparse, textwrap, time
18from scipy import ndimage
19import nemo
20
21## SVN information
22__Author__   = "$Author$"
23__Date__     = "$Date$"
24__Revision__ = "$Revision$"
25__Id__       = "$Id$"
26__HeadURL__  = "$HeadURL$"
27__SVN_Date__ = "$SVN_Date: $"
28
29###
30
31### ===== Handling command line parameters ==================================================
32# Creating a parser
33parser = argparse.ArgumentParser (
34    description = """Compute calving weights""",
35    epilog='-------- End of the help message --------')
36
37# Adding arguments
38parser.add_argument ('--oce'     , help='oce model name', type=str, default='eORCA1.2', choices=['ORCA2.3', 'eORCA1.2', 'eORCA025'] )
39parser.add_argument ('--atm'     , help='atm model name (ICO* or LMD*)', type=str, default='ICO40'    )
40parser.add_argument ('--type'    , help='Type of distribution', type=str, choices=['iceshelf', 'iceberg', 'nosouth', 'full'], default='full'  )
41parser.add_argument ('--dir'     , help='Directory of input file', type=str, default='./' )
42parser.add_argument ('--repartition_file', help='Data files with iceberg melting' , type=str, default='./runoff-icb_DaiTrenberth_Depoorter_eORCA1_JD.nc' )
43parser.add_argument ('--repartition_var' , help='Variable name for iceshelf'      , type=str, default=None)
44
45# Parse command line
46myargs = parser.parse_args()
47
48# Model Names
49src_Name = myargs.atm ; dst_Name = myargs.oce
50   
51# Default vars
52if myargs.repartition_var == None :
53    # Runoff from Antarctica iceshelves (Depoorter, 2013)
54    if myargs.type == 'iceshelf' : repartitionVar = 'sornfisf'
55       
56    # Runoff from Antarctica iceberg (Depoorter, 2013)
57    if myargs.type == 'iceberg' :  repartitionVar = 'Icb_Flux'
58       
59else :                             repartitionVar = myargs.repartition_var
60
61# Latitude limits of each calving zone
62limit_lat = ( (40.0, 90.0), (-50.0, 40.0), ( -90.0, -50.0) )
63
64nb_zone = len(limit_lat)
65### ==========================================================================================
66
67# Model short names
68src_name = None ; dst_name = None
69if src_Name.count('ICO')  != 0 : src_name = 'ico'
70if src_Name.count('LMD')  != 0 : src_name = 'lmd'
71if dst_Name.count('ORCA') != 0 : dst_name = 'orc'
72
73CplModel = dst_Name + 'x' + src_Name
74
75print ('Atm names : ' + src_name + ' ' + src_Name )
76print ('Oce names : ' + dst_name + ' ' + dst_Name )
77print (' ')
78
79# Reading domains characteristics
80areas = myargs.dir + '/areas_' + dst_Name + 'x' + src_Name + '.nc' 
81masks = myargs.dir + '/masks_' + dst_Name + 'x' + src_Name + '.nc'
82grids = myargs.dir + '/grids_' + dst_Name + 'x' + src_Name + '.nc'
83
84print ('Opening ' + areas)
85f_areas = netCDF4.Dataset ( areas, "r" )
86print ('Opening ' + masks)
87f_masks = netCDF4.Dataset ( masks, "r" )
88print ('Opening ' + grids)
89f_grids = netCDF4.Dataset ( grids, "r" )
90
91src_lon = f_grids.variables ['t' + src_name + '.lon'][:]
92src_lat = f_grids.variables ['t' + src_name + '.lat'][:]
93dst_lon = f_grids.variables ['t' + dst_name + '.lon'][:]
94dst_lat = f_grids.variables ['t' + dst_name + '.lat'][:]
95
96src_msk = f_masks.variables ['t' + src_name + '.msk'][:]
97dst_msk = f_masks.variables ['t' + dst_name + '.msk'][:]
98dst_mskutil = 1-dst_msk # Reversing the convention : 0 on continent, 1 on ocean
99print ('dst_msk     : ' + str(np.sum(dst_msk)))
100print ('dst_mskutil : ' + str(np.sum(dst_mskutil)))
101
102# Periodicity masking for NEMO
103if dst_Name == 'ORCA2.3'  : nperio_dst = 4
104if dst_Name == 'eORCA1.2' : nperio_dst = 6
105if dst_Name == 'ORCA025'  : nperio_dst = 6
106if dst_Name == 'eORCA025' : nperio_dst = 6
107print ('nperio_dst: ' + str(nperio_dst) )
108dst_mskutil = nemo.lbc_mask (dst_mskutil, nperio=nperio_dst, cd_type='T' )
109print ('dst_mskutil : ' + str(np.sum(dst_mskutil)))
110
111##
112## Fill Closed seas and other
113## ==================================================
114
115# Preparation by closing some straits
116# -----------------------------------
117if dst_Name == 'eORCA025' :
118    print ('Filling some seas for eORCA025')
119    # Set Gibraltar strait to 0 to fill Mediterranean sea
120    dst_mskutil[838:841,1125] = 0
121    # Set Bal-El-Mandeb to 0 to fill Red Sea
122    dst_mskutil[736,1321:1324] = 0
123    # Set Stagerak to 0 to fill Baltic Sea
124    dst_mskutil[961,1179:1182] = 0
125    # Set Ormuz Strait to 0 to fill Arabo-Persian Gulf
126    dst_mskutil[794:798,1374] = 0
127    # Set Hudson Strait to 0 to fill Hudson Bay
128    dst_mskutil[997:1012,907] = 0
129   
130if dst_Name == 'eORCA1.2' :
131    print ('Filling some seas for eORCA1.2')
132    # Set Gibraltar strait to 0 to fill Mediterrean sea
133    dst_mskutil[240, 283] = 0
134    # Set Bal-El-Mandeb to 0 to fill Red Sea
135    dst_mskutil[211:214, 332] = 0
136    # Set Stagerak to 0 to fill Baltic Sea
137    dst_mskutil[272:276, 293] = 0
138    # Set Ormuz Strait to 0 to fill Arabo-Persian Gulf
139    dst_mskutil[227:230, 345] = 0
140    # Set Hudson Strait to 0 to fill Hudson Bay
141    dst_mskutil[284,222:225] = 0
142   
143if dst_Name == 'ORCA2.3' :
144    print ('Filling some seas for ORCA2.3')
145    # Set Gibraltar strait to 0 to fill Mediterrean sea
146    dst_mskutil[101,139] = 0
147    # Set Black Sea to zero. At the edge of the domain : binary_fill_holes fails
148    dst_mskutil[ 99:111,   0:  5] = 0
149    dst_mskutil[106:111, 173:182] = 0
150    # Set Stagerak to 0 to fill Baltic Sea
151    dst_mskutil[115,144] = 0
152    # Set Hudson Strait to 0 to fill Hudson Bay
153    dst_mskutil[120:123,110] = 0
154    # Set Bal-El-Mandeb to 0 to fill Red Sea
155    dst_mskutil[87:89,166] = 0
156
157dst_closed = dst_mskutil
158
159# Fill closed seas with image processing library
160# ----------------------------------------------
161dst_mskutil = nemo.lbc_mask ( 1-ndimage.binary_fill_holes (1-nemo.lbc(dst_mskutil, nperio=nperio_dst, cd_type='T')), nperio=nperio_dst, cd_type='T' )
162
163# Surfaces
164src_srf = f_areas.variables ['t' + src_name + '.srf']
165dst_srf = f_areas.variables ['t' + dst_name + '.srf']
166dst_srfutil = dst_srf * np.float64 (dst_mskutil)
167
168dst_srfutil_sum = np.sum( dst_srfutil)
169
170src_clo = f_grids.variables ['t' + src_name + '.clo'][:]
171src_cla = f_grids.variables ['t' + src_name + '.cla'][:]
172dst_clo = f_grids.variables ['t' + dst_name + '.clo'][:]
173dst_cla = f_grids.variables ['t' + dst_name + '.cla'][:]
174
175# Indices
176( src_jpj, src_jpi) = src_lat.shape ; src_grid_size = src_jpj*src_jpi
177( dst_jpj, dst_jpi) = dst_lat.shape ; dst_grid_size = dst_jpj*dst_jpi
178orc_index = np.arange (dst_jpj*dst_jpi, dtype=np.int32) + 1 # Fortran indices (starting at one)
179
180### ===== Reading needed data ==================================================
181if myargs.type in ['iceberg', 'iceshelf' ]: 
182    # Reading data file for calving or iceberg geometry around Antarctica
183    print ( 'Opening ' + myargs.repartition_file)
184    f_repartition = netCDF4.Dataset ( myargs.repartition_file, "r" )
185    repartition = np.sum ( f_repartition.variables [repartitionVar][:], axis=0 )
186
187## Before loop on basins
188remap_matrix = np.empty ( shape=(0), dtype=np.float64 )
189src_address  = np.empty ( shape=(0), dtype=np.int32   )
190dst_address  = np.empty ( shape=(0), dtype=np.int32   )
191
192print (' ')
193
194### ===== Starting loop on basins==============================================
195
196# Initialise some fields
197remap_matrix = np.empty ( shape=(0), dtype=np.float64 )
198src_address  = np.empty ( shape=(0), dtype=np.int32   )
199dst_address  = np.empty ( shape=(0), dtype=np.int32   )
200
201basin_msk       = np.zeros( shape=(nb_zone, dst_jpj, dst_jpi), dtype=np.float32)
202key_repartition = np.zeros( shape=(nb_zone, dst_jpj, dst_jpi), dtype=np.float64)
203
204## Loop
205for n_bas in np.arange ( nb_zone ) :
206    south = False ; ok_run = False
207    lat_south = np.min(limit_lat[n_bas]) ; lat_north = np.max(limit_lat[n_bas])
208    if lat_south <= -60.0 : south = True
209   
210    print ( 'basin: {:2d} -- Latitudes: {:+.1f} {:+.1f} --'.format(n_bas, lat_south, lat_north) )
211    ##
212    if myargs.type == 'iceberg'  and     south : ok_run = True  ; print ('Applying iceberg to south' )
213    if myargs.type == 'iceshelf' and     south : ok_run = True  ; print ('Applying iceshelf to south' )
214    if myargs.type == 'iceberg'  and not south : ok_run = False ; print ('Skipping iceberg: not south ')
215    if myargs.type == 'iceshelf' and not south : ok_run = False ; print ('Skipping iceshelf: not south ')
216    if myargs.type == 'nosouth'  and     south : ok_run = False ; print ('Skipping south: nosouth case' )
217    if myargs.type == 'nosouth'  and not south : ok_run = True  ; print ('Running: not in south, uniform repartition')
218    if myargs.type == 'full'                   : ok_run = True  ; print ('Running general trivial case, uniform repartition' )
219
220    if ok_run :
221        # Calving integral send to one point per latitude bands
222        index_src = ((src_grid_size - 1)*n_bas) // (nb_zone-1) + 1
223   
224        # Basin mask
225        basin_msk[n_bas] = np.where ( (dst_lat > lat_south ) & (dst_lat <= lat_north ), dst_mskutil, 0 )
226
227        # Repartition pattern
228        if myargs.type in ['iceberg', 'iceshelf' ] : key_repartition[n_bas] = repartition * basin_msk[n_bas]
229        else :                                       key_repartition[n_bas] =               basin_msk[n_bas]
230
231        # Integral and normalisation
232        sum_repartition = np.sum ( key_repartition[n_bas] * dst_srfutil )
233        key_repartition = key_repartition / sum_repartition
234   
235        print ( 'Sum of repartition key                      : {:12.3e}'.format (np.sum (key_repartition[n_bas]               )) )
236        print ( 'Integral (area weighted) of repartition key : {:12.3e}'.format (np.sum (key_repartition[n_bas] * dst_srfutil )) )
237   
238        # Basin surface (modulated by repartition key)
239        basin_srfutil = np.sum ( key_repartition[n_bas] * dst_srfutil )
240           
241        # Weights and links
242        poids = 1.0 / basin_srfutil
243        matrix_local   = np.where ( basin_msk[n_bas].ravel() > 0.5, key_repartition[n_bas].ravel()*poids, 0. )
244        matrix_local   = matrix_local[matrix_local > 0.0] # Keep only non zero values
245        num_links      = np.count_nonzero (matrix_local)
246        # Address on source grid : all links points to the same LMDZ point.
247        src_address_local = np.ones(num_links, dtype=np.int32 )*index_src
248        # Address on destination grid : each NEMO point with non zero link
249        dst_address_local = np.where ( key_repartition[n_bas].ravel() > 0.0, orc_index, 0)
250        dst_address_local = dst_address_local[dst_address_local > 0]
251        # Append to global tabs
252        remap_matrix = np.append ( remap_matrix, matrix_local      )
253        src_address  = np.append ( src_address , src_address_local )
254        dst_address  = np.append ( dst_address , dst_address_local )
255        #
256        #print ( 'Sum of remap_matrix : {:12.3e}'.format(np.sum(matrix_local)) )
257        print ( 'Point in atmospheric grid : {:4d} -- num_links: {:6d}'.format(index_src, num_links) ) 
258        print ('  ')
259
260## End of loop
261print (' ')
262
263#
264num_links = np.count_nonzero (remap_matrix)
265print ( 'Total num_links : {:10d}'.format(num_links) )
266
267### ===== Writing the weights file, for OASIS MCT ==========================================
268
269# Output file
270calving = 'rmp_t' + src_Name + '_to_' + 't' + dst_Name + '_calving_' + myargs.type + '.nc'
271f_calving = netCDF4.Dataset ( calving, 'w', format='NETCDF3_64BIT' )
272
273print ('Output file: ' + calving )
274
275f_calving.Conventions     = "CF-1.6"
276f_calving.source          = "IPSL Earth system model"
277f_calving.group           = "ICMC IPSL Climate Modelling Center"
278f_calving.Institution     = "IPSL https.//www.ipsl.fr"
279f_calving.Ocean           = dst_Name + " https://www.nemo-ocean.eu"
280f_calving.Atmosphere      = src_Name + " http://lmdz.lmd.jussieu.fr"
281if myargs.type in ['iceberg', 'iceshelf' ]: f_calving.originalFiles = myargs.repartition_file
282f_calving.associatedFiles = grids + " " + areas + " " + masks
283f_calving.directory       = os.getcwd ()
284f_calving.description     = "Generated with XIOS http://forge.ipsl.jussieu.fr/ioserver and MOSAIX https://forge.ipsl.jussieu.fr/igcmg/browser/TOOLS/MOSAIX"
285f_calving.title           = calving
286f_calving.Program         = "Generated by " + sys.argv[0] + " with flags " + str(sys.argv[1:])
287f_calving.timeStamp       = time.asctime()
288f_calving.uuid            = f_areas.uuid
289f_calving.HOSTNAME        = platform.node()
290#f_calving.LOGNAME         = os.getlogin()
291f_calving.Python          = "Python version " +  platform.python_version()
292f_calving.OS              = platform.system()
293f_calving.release         = platform.release()
294f_calving.hardware        = platform.machine()
295f_calving.Comment         = "Preliminary attempt - Do not trust !"
296f_calving.conventions     = "SCRIP"
297if src_name == 'lmd' : f_calving.source_grid = "curvilinear"
298if src_name == 'ico' : f_calving.source_grid = "unstructured"
299f_calving.dest_grid       = "curvilinear"
300f_calving.Model           = "IPSL CM6"
301f_calving.SVN_Author      = "$Author$"
302f_calving.SVN_Date        = "$Date$"
303f_calving.SVN_Revision    = "$Revision$"
304f_calving.SVN_Id          = "$Id$"
305f_calving.SVN_HeadURL     = "$HeadURL$"
306
307d_nb_zone          = f_calving.createDimension ('nb_zone'         ,   nb_zone )
308d_num_links        = f_calving.createDimension ('num_links'       , num_links )
309d_num_wgts         = f_calving.createDimension ('num_wgts'        ,         1 )
310
311d_src_grid_size    = f_calving.createDimension ('src_grid_size'   , src_grid_size )
312d_src_grid_corners = f_calving.createDimension ('src_grid_corners', src_clo.shape[0]  )
313D_src_grid_rank    = f_calving.createDimension ('src_grid_rank'   ,        2  )
314
315d_dst_grid_size    = f_calving.createDimension ('dst_grid_size'   , dst_grid_size )
316d_dst_grid_corners = f_calving.createDimension ('dst_grid_corners', dst_clo.shape[0] )
317d_dst_grid_rank    = f_calving.createDimension ('dst_grid_rank'   ,        2  )
318
319v_remap_matrix = f_calving.createVariable ( 'remap_matrix', 'f8', ('num_links', 'num_wgts') )
320v_src_address  = f_calving.createVariable ( 'src_address' , 'i4', ('num_links',) )
321v_src_address  = f_calving.createVariable ( 'dst_address' , 'i4', ('num_links',) )
322
323v_remap_matrix[:] = remap_matrix
324v_src_address [:] = src_address
325v_src_address [:] = src_address
326
327v_src_grid_dims       = f_calving.createVariable ( 'src_grid_dims'      , 'i4', ('src_grid_rank',) )
328v_src_grid_center_lon = f_calving.createVariable ( 'src_grid_center_lon', 'i4', ('src_grid_size',) )
329v_src_grid_center_lat = f_calving.createVariable ( 'src_grid_center_lat', 'i4', ('src_grid_size',) )
330v_src_grid_center_lon.units='degrees_east'  ; v_src_grid_center_lon.long_name='Longitude'
331v_src_grid_center_lon.long_name='longitude' ; v_src_grid_center_lon.bounds="src_grid_corner_lon" 
332v_src_grid_center_lat.units='degrees_north' ; v_src_grid_center_lat.long_name='Latitude'
333v_src_grid_center_lat.long_name='latitude ' ; v_src_grid_center_lat.bounds="src_grid_corner_lat" 
334v_src_grid_corner_lon = f_calving.createVariable ( 'src_grid_corner_lon', 'f8', ('src_grid_size', 'src_grid_corners')  )
335v_src_grid_corner_lat = f_calving.createVariable ( 'src_grid_corner_lat', 'f8', ('src_grid_size', 'src_grid_corners')  )
336v_src_grid_corner_lon.units="degrees_east"
337v_src_grid_corner_lat.units="degrees_north"
338v_src_grid_area       = f_calving.createVariable ( 'src_grid_area'      , 'f8', ('src_grid_size',)  )
339v_src_grid_area.long_name="Grid area" ; v_src_grid_area.standard_name="cell_area" ; v_src_grid_area.units="m2"
340v_src_grid_imask      = f_calving.createVariable ( 'src_grid_imask'     , 'f8', ('src_grid_size',)  )
341v_src_grid_imask.long_name="Land-sea mask" ; v_src_grid_imask.units="Land:1, Ocean:0"
342
343v_src_grid_dims      [:] = ( src_jpi, src_jpi ) 
344v_src_grid_center_lon[:] = src_lon[:].ravel()
345v_src_grid_center_lat[:] = src_lat[:].ravel()
346v_src_grid_corner_lon[:] = src_clo.reshape( (src_jpi*src_jpj, d_src_grid_corners.__len__()) )
347v_src_grid_corner_lat[:] = src_cla.reshape( (src_jpi*src_jpj, d_src_grid_corners.__len__()) )
348v_src_grid_area      [:] = src_srf[:].ravel()
349v_src_grid_imask     [:] = src_msk[:].ravel()
350
351# --
352
353v_dst_grid_dims       = f_calving.createVariable ( 'dst_grid_dims'      , 'i4', ('dst_grid_rank',) )
354v_dst_grid_center_lon = f_calving.createVariable ( 'dst_grid_center_lon', 'i4', ('dst_grid_size',) )
355v_dst_grid_center_lat = f_calving.createVariable ( 'dst_grid_center_lat', 'i4', ('dst_grid_size',) )
356v_dst_grid_center_lon.units='degrees_east'  ; v_dst_grid_center_lon.long_name='Longitude'
357v_dst_grid_center_lon.long_name='longitude' ; v_dst_grid_center_lon.bounds="dst_grid_corner_lon" 
358v_dst_grid_center_lat.units='degrees_north' ; v_dst_grid_center_lat.long_name='Latitude'
359v_dst_grid_center_lat.long_name='latitude'  ; v_dst_grid_center_lat.bounds="dst_grid_corner_lat" 
360v_dst_grid_corner_lon = f_calving.createVariable ( 'dst_grid_corner_lon', 'f8', ('dst_grid_size', 'dst_grid_corners')  )
361v_dst_grid_corner_lat = f_calving.createVariable ( 'dst_grid_corner_lat', 'f8', ('dst_grid_size', 'dst_grid_corners')  )
362v_dst_grid_corner_lon.units="degrees_east"
363v_dst_grid_corner_lat.units="degrees_north"
364v_dst_grid_area       = f_calving.createVariable ( 'dst_grid_area'      , 'f8', ('dst_grid_size',)  )
365v_dst_grid_area.long_name="Grid area" ; v_dst_grid_area.standard_name="cell_area" ; v_dst_grid_area.units="m2"
366v_dst_grid_imask      = f_calving.createVariable ( 'dst_grid_imask'     , 'f8', ('dst_grid_size',)  )
367v_dst_grid_imask.long_name="Land-sea mask" ; v_dst_grid_imask.units="Land:1, Ocean:0"
368
369v_dst_bassin      = f_calving.createVariable ( 'dst_bassin'      , 'f8', ('nb_zone', 'dst_grid_size',)  )
370v_dst_repartition = f_calving.createVariable ( 'dst_repartition' , 'f8', ('nb_zone', 'dst_grid_size',)  )
371
372v_dst_grid_dims      [:] = ( dst_jpi, dst_jpi ) 
373v_dst_grid_center_lon[:] = dst_lon[:].ravel()
374v_dst_grid_center_lat[:] = dst_lat[:].ravel()
375v_dst_grid_corner_lon[:] = dst_clo.reshape( (dst_jpi*dst_jpj, d_dst_grid_corners.__len__()) )
376v_dst_grid_corner_lat[:] = dst_cla.reshape( (dst_jpi*dst_jpj, d_dst_grid_corners.__len__()) )
377v_dst_grid_area      [:] = dst_srf[:].ravel()
378v_dst_grid_imask     [:] = dst_msk[:].ravel()
379
380v_dst_bassin[:]      = basin_msk.reshape      ( (nb_zone,dst_grid_size) )
381v_dst_repartition[:] = key_repartition.reshape( (nb_zone,dst_grid_size) )
382
383# Additoonnal fields for debugging
384# ================================
385v_dst_grid_imaskutil      = f_calving.createVariable ( 'dst_grid_imaskutil'     , 'f8', ('dst_grid_size',)  )
386v_dst_grid_imaskutil.long_name="Land-sea mask" ; v_dst_grid_imaskutil.units="Land:1, Ocean:0"
387v_dst_grid_imaskclose      = f_calving.createVariable ( 'dst_grid_imaskclose'     , 'f8', ('dst_grid_size',)  )
388v_dst_grid_imaskclose.long_name="Land-sea mask" ; v_dst_grid_imaskclose.units="Land:1, Ocean:0"
389v_dst_grid_imaskutil [:] = dst_mskutil[:].ravel()
390v_dst_grid_imaskclose[:] = dst_closed[:].ravel()
391
392v_dst_lon_addressed = f_calving.createVariable ( 'dst_lon_addressed', 'f8', ('num_links',) )
393v_dst_lat_addressed = f_calving.createVariable ( 'dst_lat_addressed', 'f8', ('num_links',) )
394v_dst_lon_addressed.long_name="Longitude" ; v_dst_lon_addressed.standard_name="longitude" ; v_dst_lon_addressed.units="degrees_east"
395v_dst_lat_addressed.long_name="Latitude"  ; v_dst_lat_addressed.standard_name="latitude"  ; v_dst_lat_addressed.units="degrees_north"
396v_dst_area_addressed  = f_calving.createVariable ( 'dst_area_addressed', 'f8', ('num_links',) )
397v_dst_area_addressed.long_name="Grid area" ; v_dst_area_addressed.standard_name="cell_area" ; v_dst_grid_area.units="m2"
398v_dst_imask_addressed = f_calving.createVariable ( 'dst_imask_addressed', 'i4', ('num_links',) )
399v_dst_imask_addressed.long_name="Land-sea mask" ; v_dst_imask_addressed.units="Land:1, Ocean:0"
400v_dst_imaskutil_addressed = f_calving.createVariable ( 'dst_imaskutil_addressed', 'i4', ('num_links',) )
401v_dst_imaskutil_addressed.long_name="Land-sea mask" ; v_dst_imaskutil_addressed.units="Land:1, Ocean:0"
402
403v_dst_lon_addressed  [:] = dst_lon.ravel()[dst_address-1].ravel()
404v_dst_lat_addressed  [:] = dst_lat.ravel()[dst_address-1].ravel()
405v_dst_area_addressed [:] = dst_srf[:].ravel()[dst_address-1].ravel()
406v_dst_imask_addressed[:] = dst_msk[:].ravel()[dst_address-1].ravel()
407v_dst_imaskutil_addressed[:] = dst_mskutil.ravel()[dst_address-1].ravel()
408
409f_calving.close ()
410
411
412### ===== That's all Folk's !! ==============================================
Note: See TracBrowser for help on using the repository browser.