New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
make_bathy.py in branches/2015/dev_r5102_CNRS11_TestCase/NEMOGCM/TOOLS/TEST_CASES/CREATE_FILES – NEMO

source: branches/2015/dev_r5102_CNRS11_TestCase/NEMOGCM/TOOLS/TEST_CASES/CREATE_FILES/make_bathy.py @ 5346

Last change on this file since 5346 was 5287, checked in by flavoni, 9 years ago

commit scripts python to create files needed for test cases,and examples; related to ticket #1469

  • Property svn:executable set to *
File size: 806 bytes
Line 
1#!/opt/local/bin/python
2
3import os,sys
4from netCDF4 import Dataset as netcdf
5import numpy as np
6
7resname='r025'
8
9# input file
10fcoord='coordinates_'+str(resname)+'.nc'
11
12# output file
13fbathy='bathy_'+str(resname)+'.nc'
14
15# Reading coordinates file
16nccoord=netcdf(fcoord,'r')
17nav_lon=nccoord.variables['glamt']
18nav_lat=nccoord.variables['gphit']
19LON1= nav_lon.shape[1]
20LAT1= nav_lon.shape[0]
21
22print '   creating bathymetry file  '+fbathy+'...'
23
24# Creating bathy netcdf file
25nc=netcdf(fbathy,'w')
26nc.createDimension('y',LAT1)
27nc.createDimension('x',LON1)
28
29cdflon=nc.createVariable('nav_lon','f',('y','x'))
30cdflat=nc.createVariable('nav_lat','f',('y','x'))
31cdfbathy=nc.createVariable('Bathymetry','f',('y','x'))
32
33cdflon[:,:]=nav_lon[:,:]
34cdflat[:,:]=nav_lat[:,:]
35cdfbathy[:,:]=5000
36
37nc.close()
38nccoord.close()
39
40
Note: See TracBrowser for help on using the repository browser.