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_FLX.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_FLX.py @ 5287

Last change on this file since 5287 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.2 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 file
13fflx='flx_'+str(resname)+'.nc'
14
15print '   creating FLX file  '+fflx+'...'
16
17# Reading coordinates file
18nccoord=netcdf(fcoord,'r')
19nav_lon=nccoord.variables['glamt']
20nav_lat=nccoord.variables['gphit']
21LON1= nav_lon.shape[1]
22LAT1= nav_lon.shape[0]
23
24# Creating FLX netcdf file
25nc=netcdf(fflx,'w')
26nc.createDimension('y',LAT1)
27nc.createDimension('x',LON1)
28nc.createDimension('time_counter',None)
29
30cdflon=nc.createVariable('nav_lon','f',('y','x'))
31cdflat=nc.createVariable('nav_lat','f',('y','x'))
32cdftimecounter=nc.createVariable('time_counter','f',('time_counter'))
33cdfutau=nc.createVariable('utau','f',('time_counter','y','x'))
34cdfvtau=nc.createVariable('vtau','f',('time_counter','y','x'))
35cdfqtot=nc.createVariable('qtot','f',('time_counter','y','x'))
36cdfqsr=nc.createVariable('qsr','f',('time_counter','y','x'))
37cdfemp=nc.createVariable('emp','f',('time_counter','y','x'))
38
39cdflon[:,:]=nav_lon[:,:]
40cdflat[:,:]=nav_lat[:,:]
41
42# Fill fields
43
44cdfutau[:,:,:]=-0.1
45cdfvtau[:,:,:]=0
46cdfqtot[:,:,:]=0
47cdfqsr[:,:,:]=0
48cdfemp[:,:,:]=0
49
50nc.close()
51nccoord.close()
52
53#sys.exit()
Note: See TracBrowser for help on using the repository browser.