Changeset 755 in lmdz_wrf
- Timestamp:
- May 4, 2016, 12:28:23 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r754 r755 1008 1008 print errormsg 1009 1009 print ' ' + fname + ': File "' + ncfile + '" does not exist !!' 1010 print errormsg1011 1010 quit(-1) 1012 1011 … … 1014 1013 print errormsg 1015 1014 print ' ' + fname + ': Reference file "' + refnc + '" does not exist !!' 1016 print errormsg1017 1015 quit(-1) 1018 1016 … … 1021 1019 1022 1020 refvars = ncref.variables 1023 if searchInlist(refvars, refvar):1021 if gen.searchInlist(refvars, refvar): 1024 1022 refvarv = ncref.variables[refvar] 1025 1023 else: … … 1038 1036 newdims = ncf.dimensions 1039 1037 for rdim in vardims: 1040 if not searchInlist(newdims, rdim):1038 if not gen.searchInlist(newdims, rdim): 1041 1039 print ' ' + fname + ': Adding dimension ' + rdim 1042 1040 ncf.close() … … 1048 1046 # Checking fill value 1049 1047 ## 1050 if searchInlist(varattr, '_FillValue'):1048 if gen.searchInlist(varattr, '_FillValue'): 1051 1049 varfil = refvarv._FillValue 1052 1050 else: … … 1094 1092 newvarattrs = newvar.ncattrs() 1095 1093 attrv = refvarv.getncattr(attr) 1096 if not searchInlist(newvarattrs, attr):1094 if not gen.searchInlist(newvarattrs, attr): 1097 1095 newvar.setncattr(attr, attrv) 1098 1096 … … 1118 1116 print errormsg 1119 1117 print ' ' + fname + ': File "' + ncfile + '" does not exist !!' 1120 print errormsg1121 1118 quit(-1) 1122 1119 … … 1124 1121 print errormsg 1125 1122 print ' ' + fname + ': Reference file "' + refnc + '" does not exist !!' 1126 print errormsg1127 1123 quit(-1) 1128 1124 … … 1131 1127 1132 1128 refdims = ncref.dimensions 1133 if searchInlist(refdims, refdim):1129 if gen.searchInlist(refdims, refdim): 1134 1130 refdimv = ncref.dimensions[refdim] 1135 1131 else: … … 1170 1166 print errormsg 1171 1167 print ' fattradd: File "' + ncfile + '" does not exist !!' 1172 print errormsg1173 1168 quit(-1) 1174 1169 … … 1176 1171 print errormsg 1177 1172 print ' fattradd: Reference file "' + refnc + '" does not exist !!' 1178 print errormsg1179 1173 quit(-1) 1180 1174 … … 1183 1177 1184 1178 vars = ncf.variables 1185 if searchInlist(vars, var):1179 if gen.searchInlist(vars, var): 1186 1180 varv = ncf.variables[var] 1187 1181 else: … … 1192 1186 1193 1187 refvars = ncref.variables 1194 if searchInlist(refvars, refvar):1188 if gen.searchInlist(refvars, refvar): 1195 1189 refvarv = ncref.variables[refvar] 1196 1190 else: … … 1225 1219 print errormsg 1226 1220 print ' fgaddattr: File "' + ncfile + '" does not exist !!' 1227 print errormsg1228 1221 quit(-1) 1229 1222 … … 1231 1224 print errormsg 1232 1225 print ' fgaddattr: Reference file "' + refnc + '" does not exist !!' 1233 print errormsg1234 1226 quit(-1) 1235 1227 … … 5277 5269 objdim = nciobj.dimensions[dims] 5278 5270 dimsize = -1 5279 if not searchInlist(dimns, dims):5271 if not gen.searchInlist(dimns, dims): 5280 5272 if objdim.isunlimited(): 5281 5273 dimsize = None … … 5343 5335 varslice = [] 5344 5336 for dimname in varorigdims: 5345 if searchInlist(dimns, dimname):5337 if gen.searchInlist(dimns, dimname): 5346 5338 varslice.append(slice(dimslices[dimname][0], \ 5347 5339 dimslices[dimname][1], dimslices[dimname][2])) … … 5358 5350 # print ' final variable dimensions:',vardims 5359 5351 varattrs = varobj.ncattrs() 5360 if searchInlist(varattrs, '_FillValue'):5352 if gen.searchInlist(varattrs, '_FillValue'): 5361 5353 varfil = varobj._FillValue 5362 5354 else:
Note: See TracChangeset
for help on using the changeset viewer.