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

Last change on this file since 825 was 825, checked in by dubos, 5 years ago

devel/Python : moved Fortran bindings and *.pyx to dynamico/dev module + necessary changes to test/py/*.py

File size: 951 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()
16for arg in vars(args): print arg, getattr(args, arg)
17
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.