Changeset 1950 in lmdz_wrf
- Timestamp:
- Jul 22, 2018, 7:05:36 PM (7 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/create_OBSnetcdf.py
r1949 r1950 11 11 12 12 # version 13 version=1. 113 version=1.2 14 14 15 15 # Filling values for floats, integer and string … … 1028 1028 """ Function to add a variabe providing description of a units based on WMO code 1029 1029 unitsn= name of the units (all WMO codes derived units must be labelled as 1030 ' codeWMO_[num]' associated to a file valled wmo_[num].code)1030 'wmo_code_[num]' associated to a file valled wmo_[num].code) 1031 1031 onc= netCDF object file to add the description 1032 1032 Lstrcode= length of description of codes 1033 1033 1034 1034 wmo_[num].code must have the structure: ('#' for comments) 1035 reference :web page, document reference with the code1036 short_description :main description of the code1037 long_description :long description of the code1038 codeTYPE :type of the code (andy of 'D', 'F', 'I', 'S')1039 @ :Values line giving the start of the values1040 [val1] =[meaning of first value]1035 reference|web page, document reference with the code 1036 short_description|main description of the code 1037 long_description|long description of the code 1038 codeTYPE|type of the code (andy of 'D', 'F', 'I', 'S') 1039 @| Values line giving the start of the values 1040 [val1]|[meaning of first value] 1041 1041 (...) 1042 [valN] =[meaning of last value]1042 [valN]|[meaning of last value] 1043 1043 """ 1044 1044 fname = 'WMOcodevar' … … 1047 1047 folder = os.path.dirname(os.path.realpath(__file__)) 1048 1048 1049 code = unitsn.split('_')[ 1]1049 code = unitsn.split('_')[2] 1050 1050 1051 1051 infile = folder + '/wmo_' + code +'.code' … … 1056 1056 return 1057 1057 # main expected values 1058 descvals = [' reference', 'short_description', 'long_description', 'codeTYPE', \1059 ' @']1058 descvals = ['wmo_code', 'reference', 'short_description', 'long_description', \ 1059 'codeTYPE', '@'] 1060 1060 1061 1061 availcodetype = ['D', 'F', 'I', 'S'] … … 1069 1069 if len(line) > 1 and line[0:1] != '#': 1070 1070 linev = line.replace('\n','').replace('\t',' ').replace('\r','') 1071 print inivals, '<>', linev1072 1071 if not inivals: 1073 Sv = linev.split(' :')[0]1074 Vv = linev.split(' :')[1]1072 Sv = linev.split('|')[0] 1073 Vv = linev.split('|')[1] 1075 1074 if searchInlist(descvals, Sv): 1076 1075 if Sv != '@': codevalues[Sv] = Vv 1077 1076 else: inivals = True 1078 1077 else: 1079 Svv = linev.split('=')[0] 1080 Vvv = linev.split('=')[1] 1081 print 'Lluis Sv:', Svv, 'Vv:', Vvv 1078 Svv = linev.split('|')[0] 1079 Vvv = linev.split('|')[1] 1082 1080 codvals.append(Svv) 1083 1081 codmeanings.append(Vvv) … … 1088 1086 " code descriptions" 1089 1087 newdim = onc.createDimension('Lstringcode', Lstrcode) 1090 print 'Lluis Svv:', Svv1091 1088 Ncodes = len(codvals) 1092 1089 codedimn = 'wmo_code_' + str(code) … … 1123 1120 # Variable with the meaning of the code 1124 1121 if not onc.variables.has_key(codedimn+'_meaning'): 1122 print ' '+fname+": Adding '" + codedimn + "_meaning' variable for code " + \ 1123 "description" 1125 1124 newvar = onc.createVariable(codedimn+'_meaning','c',(codedimn,'Lstringcode')) 1126 print 'Lluis len Vc:', len(Vvv), 'Ncodes:', Ncodes1127 1125 writing_str_nc(newvar, codmeanings, Lstrcode) 1128 1126 newvar.setncattr('description', 'meaning of WMO code ' + str(code)) … … 1339 1337 # Getting new variables to describe certain units as codeWMO_[num] from an 1340 1338 # external file 1341 if description['varU'][ivar][0: 7] == 'codeWMO':1339 if description['varU'][ivar][0:8] == 'wmo_code': 1342 1340 WMOcodevar(description['varU'][ivar], objfile) 1343 1341 … … 1417 1415 1418 1416 set_attribute(objfile,'author_nc','Lluis Fita') 1419 set_attribute(objfile,'institution_nc',' Laboratoire de Meteorology Dynamique, ' +\1420 ' LMD-Jussieu, UPMC, Paris')1421 set_attribute(objfile,'country_nc',' France')1417 set_attribute(objfile,'institution_nc','Centro de Investigaciones del Mar y la ' + \ 1418 'Atmosfera (CIMA), CONICET-UBA, CNRS UMI-IFAECI, C.A. Buenos Aires') 1419 set_attribute(objfile,'country_nc','Argentina') 1422 1420 set_attribute(objfile,'script_nc','create_OBSnetcdf.py') 1423 1421 set_attribute(objfile,'version_script',version) 1424 1422 set_attribute(objfile,'information', \ 1425 'http://www.l md.jussieu.fr/~lflmd/ASCIIobs_nc/index.html')1423 'http://www.lluÃsfb.cat/python/PyNCplot/') 1426 1424 1427 1425 objfile.sync() -
trunk/tools/wmo_0509.code
r1949 r1950 1 reference :http://artefacts.ceda.ac.uk/badc_datadocs/surface/code.html2 short_description :High cloud type3 WMOcode:05094 long_description :Clouds of genera Cirrus, Cirrocumulus and Cirrostratus.5 codeTYPE :S6 @ :Values7 / =cirrus, cirrocumulus & cirrostratus invisible owing to darkness, fog, blowing dust or sand, or other phenomena, or more often because of the presence of a continuous layer of lower clouds8 0 =no cirrus, cirrocumulus or cirrostratus clouds9 1 =cirrus in the form of filaments, strands or hooks, not progressively invading the sky.10 2 =dense cirrus, in patches or entangled sheaves, which usually do not increase & sometimes seem to be the remains of the upper part of a cumulonimbus; or cirrus with sproutings in the form of small turrets; or cirrus having the appearance of cumuliform tufts11 3 =dense cirrus, often in the form of an anvil, being the remains of the upper part of cumulonimbus12 4 =cirrus in the form of hooks, filaments, or both, progressively invading the sky; they generally become denser as a whole.13 5 =cirrus (often in bands converging towards 1 point or 2 opposite points of the horizon) and cirrostratus, or cirrostratus alone;in either case, they are progressively invading the sky, and generally growing denser as a whole, but the continuous veil does not reach 45 degrees above the horizon.14 6 =cirrus (often in bands converging towards 1 point or 2 opposite points of the horizon) and cirrostratus, or cirrostratus alone;in either case, they are progressively invading the sky, and generally growing denser as a whole; the continuous veil extends more than 45 degrees above the horizon, without the sky being totally covered.15 7 =veil of cirrostratus covering the celestial dome16 8 =cirrostratus not progressively invading the sky and not completely covering the celestial dome.17 9 =cirrocumulus alone, or cirrocumulus accompanied by cirrus or cirrostratus, or both, but cirrocumulus is predominant1 reference|http://artefacts.ceda.ac.uk/badc_datadocs/surface/code.html 2 short_description|High cloud type 3 wmo_code|0509 4 long_description|Clouds of genera Cirrus, Cirrocumulus and Cirrostratus. 5 codeTYPE|S 6 @| Values 7 /|cirrus, cirrocumulus & cirrostratus invisible owing to darkness, fog, blowing dust or sand, or other phenomena, or more often because of the presence of a continuous layer of lower clouds 8 0|no cirrus, cirrocumulus or cirrostratus clouds 9 1|cirrus in the form of filaments, strands or hooks, not progressively invading the sky. 10 2|dense cirrus, in patches or entangled sheaves, which usually do not increase & sometimes seem to be the remains of the upper part of a cumulonimbus; or cirrus with sproutings in the form of small turrets; or cirrus having the appearance of cumuliform tufts 11 3|dense cirrus, often in the form of an anvil, being the remains of the upper part of cumulonimbus 12 4|cirrus in the form of hooks, filaments, or both, progressively invading the sky; they generally become denser as a whole. 13 5|cirrus (often in bands converging towards 1 point or 2 opposite points of the horizon) and cirrostratus, or cirrostratus alone;in either case, they are progressively invading the sky, and generally growing denser as a whole, but the continuous veil does not reach 45 degrees above the horizon. 14 6|cirrus (often in bands converging towards 1 point or 2 opposite points of the horizon) and cirrostratus, or cirrostratus alone;in either case, they are progressively invading the sky, and generally growing denser as a whole; the continuous veil extends more than 45 degrees above the horizon, without the sky being totally covered. 15 7|veil of cirrostratus covering the celestial dome 16 8|cirrostratus not progressively invading the sky and not completely covering the celestial dome. 17 9|cirrocumulus alone, or cirrocumulus accompanied by cirrus or cirrostratus, or both, but cirrocumulus is predominant
Note: See TracChangeset
for help on using the changeset viewer.