Example #1
0
Xa,Ya = np.meshgrid(xa,ya)
ka    = np.arange(ijk1[2],ijk2[2]+1)
dims  = list(np.shape(ka))  
dims.extend(list(np.shape( Xa )))
Cfs   = np.zeros( dims, float )
print(' Cfs.shape={}'.format(np.shape(Cfs)))

# = = = = = = = = = = = = = = =
scales = ya  # Rename, that's all
kList  = ka
k      = 0
for kt in kList:
  vt = v[:,kt, ijk1[1], ijk1[0]]
  
  C, freqs = continuousWaveletAnalysis( vt, wlDict )
  
  print(' Cfs[kt,:,:].shape = {}, Q.shape = {}'.format(np.shape(Cfs[k,:,:]), np.shape(C)))
  Cfs[k,:,:] = C.copy()
  k += 1


# = = output file = = = = =
# Create a NETCDF output dataset (dso) for writing out the data.
dso = netcdfOutputDataset( fileout )
xv = createNetcdfVariable( dso, xa  , 'x'   , len(xa)   , 'm', 'f4', ('x',)   , parameter )
yv = createNetcdfVariable( dso, ya  , 'y'   , len(ya)   , 'm', 'f4', ('y',)   , parameter )
zv = createNetcdfVariable( dso, ka  , 'z'   , len(ka)   , 'm', 'f4', ('z',)   , parameter )
Qv = createNetcdfVariable( dso, Cfs, 'Cfs', dims[0], '-', 'f4',('z','y','x',) , variable )

# - - - - Done , finalize the output - - - - - - - - - -
netcdfWriteAndClose( dso )
Example #2
0
    fx.write(str(nPc[2]) + "\n")
    # Loop through the verical canopy columns
    for x in range(nPc[0]):
        for y in range(nPc[1]):
            if (np.all(lad_3d[x, y, :] == 0)):
                # There is no need to write empty columns
                continue
            # Convert everything into strings and write
            # datatype x y col(:)
            lineStr = str(1) + "," + str(x) + "," + str(y) + "," + ",".join(
                map("{:.3g}".format, lad_3d[x, y, :])) + "\n"
            fx.write(lineStr)
    fx.close()
elif (args.output == "nc"):
    #Save into netCDF4 dataset
    dso = nct.netcdfOutputDataset(args.fileout)
    nPc = np.shape(lad_3d)
    xv = nct.createCoordinateAxis(dso,
                                  nPc,
                                  dpx,
                                  0,
                                  'x',
                                  'f4',
                                  'm',
                                  parameter=True)
    yv = nct.createCoordinateAxis(dso,
                                  nPc,
                                  dpx,
                                  1,
                                  'y',
                                  'f4',