source: codes/icosagcm/devel/Python/test/py/write_Cartesian_mesh.py @ 790

Last change on this file since 790 was 790, checked in by dubos, 6 years ago

devel/Python : centralize logging and command-line argument parsing + update some test cases accordingly

File size: 932 bytes
Line 
1from dynamico import getargs
2getargs.add("--nx", type=int,
3                    default=64, choices=None,
4                    help="number of x points")
5getargs.add("--ny", type=int,
6                    default=64, choices=None,
7                    help="number of y points")
8getargs.add("--Lx", type=float,
9                    default=8., choices=None,
10                    help="Lx")
11getargs.add("--Ly", type=float,
12                    default=8., choices=None,
13                    help="Ly")
14
15args = getargs.parse()
16
17from dynamico.meshes import zeros
18from dynamico import meshes
19import numpy as np
20import netCDF4 as cdf
21import argparse
22
23nx, ny, Lx, Ly, llm, nqdyn = args.nx, args.ny,args.Lx, args.Ly, 1, 1
24
25dx,dy=Lx/nx,Ly/ny
26mesh = meshes.Cartesian_mesh(nx,ny,llm,nqdyn,Lx,Ly,0.)
27print('Successfully initialized Cartesian mesh')
28mesh.ncwrite('cart_%03d_%03d.nc'%(nx,ny))
29print('Successfully written Cartesian mesh to NetCDF File')
Note: See TracBrowser for help on using the repository browser.