It is not clear to me what you want.
The following will output all the meta data associated with the
variable 'qu' which contains the monthly means of the 6-hrly products.
Based on the meta data, you used 'dim_avg_n_Wrap'
fout->qu = qu ; out qu and all associated meta data
It will not output other variables. To get p0, ps, hybrid coef, etc
you must explicitly write these to the output file. These are not
associated with 'qu'.
For assorted reasons I would write in the following order
fout->p0 = f->p0 ; or, if p0 already read fout->p0 = p0
fout->a = f->a
fout->a_bnds = f->a_bnds
etc
fout->ps = f->ps
fout->qu = qu
--- Integration: See Example 3 at http://www.ncl.ucar.edu/Document/Functions/Built-in/dpres_hybrid_ccm.shtml --- Also, you might find the following useful https://climatedataguide.ucar.edu/ Click: 'Data Sets' -> 'Atmosphere' -> Budgets' See the 'Overview' and 'ERAI' This includes a link to http://www.cgd.ucar.edu/cas/catalog/newbudgets/ Good luck On 2/25/12 6:56 AM, Jeanne Thibeault wrote: > Hello NCL users, > > I am using some CMIP5 6hrly model data (GFDL-ESM2M) to calculate > vertically integrated moisture transport. I am new at this and am > running into problems using the hybrid sigma pressure coordinates. When > I calculate q*u, I am losing information about the coefficients, ps, and > p0. I think this is at the root of my problem with the final vertical > integration. The code I use to calculate qu is below, along with the > variable list from the original ua file (via ncl_filedump), the variable > list from the 6hrly qu that I calculated (via ncl_filedump), and > printVarSummary statements from the monthly qu I wish to integrate. > > Is there a way to preserve the metadata for the hybrid coefficients, ps, > and p0 in my original q*u calculation so that I can use dpres_hybrid_ccm > with my monthly data? I have tried reading it in from one of the > original 6hrly ua files, but the time dimension doesn't match the > monthly data. Or should I interpolate the original ua and hus files onto > pressure levels before calculating qu? > > Thanks in advance for your help. > > Sincerely, > Jeanne Thibeault > > > > This is the code I am using to calculate 6rhly qu and output a new > netcdf file: > > > qu = q*u > qu!0 = "time" > qu!1 = "lev" > qu!2 = "lat" > qu!3 = "lon" > qu&lev = levu > > copy_VarMeta(u,qu) > delete_VarAtts(qu,(/"long_name","standard_name","original_name"/)) > > qu@long_name = "q*u" > qu@units = "kg kg-1 m s-1" > > printVarSummary(qu) > > ;===================================================================== > ; Create netCDF file > ;===================================================================== > > diro = "/Volumes/PEGASUS/Data/CMIP5/hist6hrly/" > filo = "qu_GFDL-ESM2M_r1i1p1_"+suf+".nc" > ncfile = diro+filo > > filAtts = True > filAtts@creation_date = systemfunc("date") > > filAtts@comment = a1@comment > filAtts@references = a1@references > filAtts@title = a1@title > filAtts@Conventions = a1@Conventions > filAtts@project_id = a1@project_id > filAtts@table_id = a1@table_id > filAtts@experiment_id = a1@experiment_id > filAtts@realization = a1@realization > filAtts@model_id = a1@model_id > filAtts@experiment = a1@experiment > filAtts@forcing = a1@forcing > filAtts@parent_experiment_rip = a1@parent_experiment_rip > system("/bin/rm -f "+ncfile) ; remove any pre-existing file > fout = addfile(ncfile ,"c") ; open output netCDF file > > fileattdef( fout, filAtts ) ; add file attributes > > filedimdef(fout,"time",-1,True) ; make time an UNLIMITED dimension > > > fout->qu = qu > > end > > > > > Original ua file 6hrly: > variables: > double a ( lev ) > bounds : a_bnds > long_name : vertical coordinate formula term: a(k) > > double a_bnds ( lev, bnds ) > long_name : vertical coordinate formula term: a(k+1/2) > > double b ( lev ) > bounds : b_bnds > long_name : vertical coordinate formula term: b(k) > > double b_bnds ( lev, bnds ) > long_name : vertical coordinate formula term: b(k+1/2) > > double lat ( lat ) > long_name : latitude > units : degrees_north > standard_name : latitude > axis : Y > bounds : lat_bnds > > double lon ( lon ) > long_name : longitude > units : degrees_east > standard_name : longitude > axis : X > bounds : lon_bnds > > double bnds ( bnds ) > long_name : vertex number > cartesian_axis : N > > float p0 ( ncl_scalar ) > long_name : reference pressure for hybrid sigma coordinate > units : Pa > > double lev ( lev ) > long_name : hybrid sigma pressure coordinate > units : 1 > positive : down > axis : Z > bounds : lev_bnds > formula : p(n,k,j,i) = a(k)*p0 + b(k)*ps(n,j,i) > formula_terms : p0: p0 a: a b: b ps: ps > standard_name : atmosphere_hybrid_sigma_pressure_coordinate > > double lev_bnds ( lev, bnds ) > formula : p(n,k,j,i) = a(k)*p0 + b(k)*ps(n,j,i) > formula_terms : p0: p0 a: a_bnds b: b_bnds ps: ps > standard_name : atmosphere_hybrid_sigma_pressure_coordinate > units : 1 > > float ps ( time, lat, lon ) > long_name : Surface Air Pressure > units : Pa > cell_methods : time: point > standard_name : surface_air_pressure > > double time ( time ) > long_name : time > units : days since 1861-01-01 00:00:00 > cartesian_axis : T > calendar_type : noleap > calendar : noleap > axis : T > standard_name : time > > float ua ( time, lev, lat, lon ) > > 6hrly qu variable list: > variables: > float qu ( time, lev, lat, lon ) > long_name : q*u > associated_files : baseURL: > http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation areacella: > areacella_fx_GFDL-ESM2M_historical_r0i0p0.nc > cell_measures : area: areacella > original_units : m/sec > _FillValue : 1e+20 > valid_range : ( -330, 350 ) > units : kg kg-1 m s-1 > missing_value : 1e+20 > cell_methods : time: point > > double time ( time ) > standard_name : time > axis : T > calendar : noleap > calendar_type : noleap > cartesian_axis : T > units : days since 1861-01-01 00:00:00 > long_name : time > double lev ( lev ) > standard_name : atmosphere_hybrid_sigma_pressure_coordinate > formula_terms : p0: p0 a: a b: b ps: ps > formula : p(n,k,j,i) = a(k)*p0 + b(k)*ps(n,j,i) > bounds : lev_bnds > axis : Z > positive : down > units : 1 > long_name : hybrid sigma pressure coordinate > > double lat ( lat ) > bounds : lat_bnds > axis : Y > standard_name : latitude > units : degrees_north > long_name : latitude > double lon ( lon ) > bounds : lon_bnds > axis : X > standard_name : longitude > units : degrees_east > long_name : longitude > > > > Monthly average from 6hrly q and u: > Variable: qu > Type: float > Total Size: 49766400 bytes > 12441600 values > Number of Dimensions: 4 > Dimensions and sizes: [time | 60] x [lev | 16] x [lat | 90] x [lon | 144] > Coordinates: > time: [40150.25..41945.25] > lev: [0.9961083927371855..0.4583251378663908] > lat: [-89.49438202247192..89.49438202247192] > lon: [1.25..358.75] > Number Of Attributes: 10 > average_op_ncl : dim_avg_n over dimension(s): time > long_name : q*u > associated_files : baseURL: > http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation areacella: > areacella_fx_GFDL-ESM2M_historical_r0i0p0.nc > cell_measures : area: areacella > original_units : m/sec > valid_range : ( -330, 350 ) > units : kg kg-1 m s-1 > missing_value : 1e+20 > cell_methods : time: point > _FillValue : 1e+20 > > Variable: lev > Type: double > Total Size: 128 bytes > 16 values > Number of Dimensions: 1 > Dimensions and sizes: [lev | 16] > Coordinates: > Number Of Attributes: 8 > standard_name : atmosphere_hybrid_sigma_pressure_coordinate > formula_terms : p0: p0 a: a b: b ps: ps > formula : p(n,k,j,i) = a(k)*p0 + b(k)*ps(n,j,i) > bounds : lev_bnds > axis : Z > positive : down > units : 1 > long_name : hybrid sigma pressure coordinate > > > > > > > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Sat Feb 25 12:23:27 2012
This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST