How to copy the metadata from one NetCDF to another

From: Xiaoming Hu <yuanfangcan_at_nyahnyahspammersnyahnyah>
Date: Thu, 11 Jan 2007 15:23:52 -0500

Thanks very much

I got the daily maximum from the NetCDF containing the hourly data.
I generated a new NetCDF file based on the daily maximum.
I am wondering if I can copy the metadata from the original NetCDF to
the new daily maximum NetCDF?
I can use PAVE to plot the original NetCDF file. But for the new daily
maximum NetCDF PAVE said
"ncattget: ncid 6: Attribute not found
invalid data set
Can't use dataset '/***************"

The way I generate the daily maximum NetCDF is
"
f = addfile (fnames(nf)+".nc", "r")
fout_dailymax = addfile("dailyout.nc" , "c")
x = f->O3
xMaxTime = dim_max( x(LAY|:, ROW|:, COL|:,TSTEP|:) )
 fout_dailymax->O3=xMaxTime"

I also attached the meta data of the original NetCDF file.
I guess PAVE need the meta data to generate the background map.
So I am wondering how to copy those meta data to my new daily maximum
NetCDF, then I can use PAVE to plot.

Sorry for my broken English

Thanks very much

Xiaoming

Dennis Shea wrote:
> Use:
>
> xMaxTime = dim_max( x(LAY|:, ROW|:, COL|:,TSTEP|:) )
>
> The {...} are for use in coordinate subscripting.
> You are using named dimensions to reorder.
>
>
>
>> I met the problem with "coordinate variable" when post processing CMAQ
>> output.
>>
>> I want to get the daily maximum of ozone concentration.
>>
>> My script is below
>>
>> ;************************************************
>> x = f->O3 ; (Time, bottom_top, south_north, west_east)
>> dims = getfilevardims(f,"O3")
>> printVarSummary(x)
>> print (dims)
>> ;************************************************
>> ; Get daily 1hr maximum
>> ;************************************************
>> xMaxTime = dim_max( x(LAY|:, {ROW|:}, {COL|:},{TSTEP|:}) )
>>
>>
>>
>> The output on the screen is
>>
>> Variable: x
>> Type: float
>> Total Size: 1784832 bytes
>> 446208 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [TSTEP | 24] x [LAY | 1] x [ROW | 112] x [COL | 166]
>> Coordinates:
>> Number Of Attributes: 3
>> long_name : O3
>> units : ppmV
>> var_desc : Variable O3
>>
>>
>> Variable: dims
>> Type: string
>> Total Size: 16 bytes
>> 4 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [4]
>> Coordinates:
>> (0) TSTEP
>> (1) LAY
>> (2) ROW
>> (3) COL
>> fatal:Dimension (TSTEP) of (x) does not have an associated coordinate
>> variable
>> fatal:Execute: Error occurred at or near line 33
>>
>>
>>
>> Any help will be greatly appreciated.
>>
>> Xiaoming
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>

netcdf O3.lyr1.2001152 {
dimensions:
        TSTEP = UNLIMITED ; // (24 currently)
        DATE-TIME = 2 ;
        LAY = 1 ;
        VAR = 1 ;
        ROW = 112 ;
        COL = 166 ;
variables:
        int TFLAG(TSTEP, VAR, DATE-TIME) ;
                TFLAG:units = "<YYYYDDD,HHMMSS>" ;
                TFLAG:long_name = "TFLAG " ;
                TFLAG:var_desc = "Timestep-valid flags: (1) YYYYDDD or (2) HHMMSS " ;
        float O3(TSTEP, LAY, ROW, COL) ;
                O3:long_name = "O3 " ;
                O3:units = "ppmV " ;
                O3:var_desc = "Variable O3 " ;

// global attributes:
                :IOAPI_VERSION = "2.2 2003141 (May 21, 2003)" ;
                :EXEC_ID = "???????????????? " ;
                :FTYPE = 1 ;
                :CDATE = 2007008 ;
                :CTIME = 15005 ;
                :WDATE = 2007008 ;
                :WTIME = 15005 ;
                :SDATE = 2001152 ;
                :STIME = 0 ;
                :TSTEP = 10000 ;
                :NTHIK = 1 ;
                :NCOLS = 166 ;
                :NROWS = 112 ;
                :NLAYS = 1 ;
                :NVARS = 1 ;
                :GDTYP = 2 ;
                :P_ALP = 30. ;
                :P_BET = 60. ;
                :P_GAM = -92. ;
                :XCENT = -92. ;
                :YCENT = 40. ;
                :XORIG = -3528000. ;
                :YORIG = -2016000. ;
                :XCELL = 36000. ;
                :YCELL = 36000. ;
                :VGTYP = 2 ;
                :VGTOP = 10000.f ;
                :VGLVLS = 1.f, 0.99f ;
                :GDNAM = "US36 " ;
                :UPNAM = "M3XTRACT " ;
                :VAR-LIST = "O3 " ;
                :FILEDESC = "Concentration file output Averaged over the synchronization time steps Timestamp represents beginning computed date/time Layer mapping (CGRID to AGRID): Layer 1 to 1 Layer 2 to 2 Layer 3 to 3 Layer 4 to 4 Layer 5 to 5 Layer 6 to 6 Layer 7 to 7 Layer 8 to 8 Layer 9 to 9 Layer 10 to 10 Layer 11 to 11 Layer 12 to 12 Layer 13 to 13 Layer 14 to 14 " ;
                :HISTORY = "" ;
}

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 11 2007 - 13:23:52 MST

This archive was generated by hypermail 2.2.0 : Tue Jan 16 2007 - 14:49:44 MST