Skip to content

Instantly share code, notes, and snippets.

import glob
import os
#This is for editing ECOR RAW files
path = '/data/home/gervais/prod/jobs/1121/collection/twp/twpecorE31.00'
os.chdir(path)
for filename in glob.glob(os.path.join(path, '*.flx')):
print filename;
with open(filename,'r') as file:
data = file.readlines();
import glob
import os
#This scrip is for modifying RAW 915rwp files, in this case I was modifying the wind angle and have a bit more code to accomidate that.
path = '/data/home/gervais/prod/jobs/0389/collection/nim/nim915rwpM1.00'
os.chdir(path)
for filename in glob.glob(os.path.join(path, '*.cnw')):
print filename;
with open(filename,'r') as file:
editcolumn = 2;#Column 3 is for the DIR variable, so I defined it here to be easy to change later
data = file.readlines();
from netCDF4 import Dataset
import glob
import time
#This is a simple script to add to the end of the history attribute in netCDF files
for f in glob.glob("/data/home/gervais/prod/jobs/0431/collection/fkb/fkbmwrhfM1.b1/*.cdf"): #Path to data
ncfile = Dataset(f, "r+");
ncfile.history +=" Modified by user <user> on machine <machine> at "+time.strftime("%d-%b-%Y,%H:%M:%S")+" using scripts/RID0431/mod.py $";#The last bit about scripts is optional
print ncfile.history;
ncfile.close();