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

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