Skip to content

Commit

Permalink
minor fix for masks
Browse files Browse the repository at this point in the history
  • Loading branch information
oloapinivad committed Nov 17, 2017
1 parent f394e8f commit 303b360
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
8 changes: 6 additions & 2 deletions 3d_pulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
expname=sys.argv[2]
var=str(sys.argv[3])
else :
expname="dycoms2_rf01_sex00"
DIRIN="/Users/paolo/Desktop/uclales_post/"+expname+"/run"
expname="dycoms2_rf01_sev02"
DIRIN="/rigel/glab/users/pd2507/uclales/"+expname+"/run"
var='u'

# since previous code in NCL change the name of some variable for
Expand Down Expand Up @@ -58,9 +58,13 @@ def rename_var(x):
vv=a.variables[dim][:]
elif (dim=='xt') :
x=a.variables[dim][:]
if (hasattr(x,"mask")==True) :
x.mask=False
vv=range(int(x[0]),int(x[0])+int(np.diff(x)[0])*len(x)*ny,int(np.diff(x)[0]))
elif (dim=='yt') :
y=a.variables[dim][:]
if (hasattr(y,"mask")==True) :
y.mask=False
vv=range(int(y[0]),int(y[0])+int(np.diff(y)[0])*len(y)*nx,int(np.diff(y)[0]))
else :
vv=a.variables[dim][1:]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ by P. Davini (ISAC-CNR, p.davini@isac.cnr.it)
*PULP* is thought as a basic tool for postprocessing output from UCLA-LES runs.
It recombines the output from different processors into single files in NETCDF4 Zip format.

It is based on Python and it is an update of the original NCL routines, being considerably faster.
It is based on Python and it is an update of the original NCL routines, being at least ~2x faster.

Be aware, I used it as a playground to learn python so that it is for sure not the most efficient
or correct code ever.
You will need to install some of the most common python packages, as numpy and netCDF4.

8 changes: 4 additions & 4 deletions master_pulp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
# master script
# based on python and cdo (just to merge and compress 3d data)

expname="dycoms2_rf01_ty00"
DIRIN=/Users/paolo/Desktop/uclales_post/$expname/run
POSTDIR=/Users/paolo/Desktop/uclales_post/$expname/post
expname="dycoms2_rf01_sev02"
DIRIN=/rigel/glab/users/pd2507/uclales/$expname/run
POSTDIR=/rigel/glab/users/pd2507/uclales/$expname/post
PULPDIR=$(pwd)

python=python
cdozip="cdo -f nc4 -z zip"

#varlist="p t u v l q w"
#varlist="pr"
#varlist="u"
varlist="l q w sc tr2 dwdt dwdtbuo dwdtdif hevc wtdif wtpre pr tl u v rf tr dwdtadv wtbuo wt wtadv"


Expand Down
5 changes: 1 addition & 4 deletions ts_pulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
maxvars=["cfl","maxdiv","wmax","rlmax","bflxmx","bflxrmx","precip_m"]
minvars=["bflxmn","bflxrmn"]

expname="dycoms2_rf01_ty00"
DIRIN="/Users/paolo/Desktop/uclales_post/"+expname+"/run"

savefile_ts= DIRIN + "/" + expname + "py.ts.nc"
savefile_ts= DIRIN + "/" + expname + ".py.ts.nc"
ncfile_ts = Dataset(savefile_ts,'w', format='NETCDF4')
time = ncfile_ts.createDimension('time', None)
times = ncfile_ts.createVariable('time', 'f4', ('time',))
Expand Down

0 comments on commit 303b360

Please sign in to comment.