source: tags/ORCHIDEE_OL/Utilitaire/recup_date.py @ 6

Last change on this file since 6 was 6, checked in by orchidee, 14 years ago

import first tag equivalent to CVS orchidee_1_9_5 + OOL_1_9_5

File size: 1.1 KB
Line 
1#######################################################################
2#PIEDLOUP Sebastien
3#sebastien.piedloup@ipsl.jussieu.fr
4#juillet 2003
5#######################################################################
6
7
8#######################################################################
9#Module qui recupere les information de date dans un fichier de forcage NETCDF
10#######################################################################
11
12
13#!/usr/bin/env python
14#. /home/p86cadul/CDAT/cdat.login_ksh
15
16#importation du module cdms de CDAT
17import cdms,cdtime,sys,os
18
19def recup():
20   
21    try:
22        for X in sys.argv[1:]:
23            if os.path.isfile(X) and X[-3:]=='.nc':
24                f=cdms.open(sys.argv[1])
25                a,m,j=f('time').units.split()[2].split('-')
26                p=int(f('timestp').tstep_sec[0])
27                n=len(f('time'))   
28            else:
29                print "usage: ",sys.argv[0],"nom_de_fichier"
30    except IndexError: 
31        print "usage: ",sys.argv[0],"nom_de_fichier"
32
33    return a,m,j,p,n       
34
35#a,m,j,p,n=recup()
36#d=n*p/86400
37#print a,m,j,p,n,d
38
39
40
41
42
Note: See TracBrowser for help on using the repository browser.