예제 #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 )
예제 #2
0
    yv = nct.createCoordinateAxis(dso,
                                  nPc,
                                  dpx,
                                  1,
                                  'y',
                                  'f4',
                                  'm',
                                  parameter=True)
    zv = nct.createCoordinateAxis(dso,
                                  nPc,
                                  dpx,
                                  2,
                                  'z',
                                  'f4',
                                  'm',
                                  parameter=True)
    lad_3d = np.rollaxis(lad_3d, 2)
    lad_3d = np.swapaxes(lad_3d, 1, 2)
    nc_ds = nct.createNetcdfVariable(dso,
                                     lad_3d,
                                     "leaf_area_density",
                                     0,
                                     'm',
                                     'f4', ('z', 'y', 'x'),
                                     parameter=False)
    nct.netcdfWriteAndClose(dso)
elif (args.output == "npz"):
    np.savez(args.fileout, R=lad_3d, dPx=dpx, GlobOrig=ds["GlobOrig"])
else:
    raise ValueError("Unknown output format: {}".format(args.output))