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_TScst_init.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_TScst_init.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: 1.1 KB
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 files
13fTSinit='TScst_init_'+str(resname)+'.nc'
14
15DEPTH1=31
16
17print '   creating TS init file  '+fTSinit+'...'
18
19# Reading coordinates file
20nccoord=netcdf(fcoord,'r')
21nav_lon=nccoord.variables['glamt']
22nav_lat=nccoord.variables['gphit']
23LON1= nav_lon.shape[1]
24LAT1= nav_lon.shape[0]
25
26# Creating TS init netcdf file
27nc=netcdf(fTSinit,'w')
28nc.createDimension('z',DEPTH1)
29nc.createDimension('y',LAT1)
30nc.createDimension('x',LON1)
31nc.createDimension('time_counter',None)
32
33cdflon=nc.createVariable('nav_lon','f',('y','x'))
34cdflat=nc.createVariable('nav_lat','f',('y','x'))
35cdfdepth=nc.createVariable('deptht','f',('z'))
36cdftimecounter=nc.createVariable('time_counter','f',('time_counter'))
37cdfthetao=nc.createVariable('thetao','f',('time_counter','z','y','x'))
38cdfso=nc.createVariable('so','f',('time_counter','z','y','x'))
39
40cdflon[:,:]=nav_lon[:,:]
41cdflat[:,:]=nav_lat[:,:]
42
43## test 1 : T & S Constants
44cdfso[0,:,:,:]=35
45cdfthetao[0,:,:,:]=10   
46
47#sys.exit()
48
49nc.close()
50nccoord.close()
51
Note: See TracBrowser for help on using the repository browser.