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
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()
[825]16for arg in vars(args): print arg, getattr(args, arg)
[790]17
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
[807]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.