Re: output of netcdf

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 03 2011 - 21:56:10 MDT

It is not clear what you are trying to do.
However, you must read the documentation on array syntax and operations.
          http://www.ncl.ucar.edu/Document/Manuals/

Maybe this will help:

;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl"
;************************************************
begin
    fn = "/storage/sdd1/Model_Out_Data/CMAQ/2010/domain1/ln/"+"20101230.nc";
    a = addfile(fn,"r")

    NO2 = a->NO2(:,0,:,:)
    NO = a->NO(:,0,:,:)
    SO2 = a->SO2(:,0,:,:)
    printVarSummary(SO2)

    NOx = NO2+NO
    copy_VarMeta(NO2, NOx)
    NOx@long_name = "NOx"
    printVarSummary(NOx)

    avgSO2 = dim_avg_n_Wrap(SO2, 0)
    avgNOx = dim_avg_n_Wrap(NOx, 0)
    printVarSummary(avgSO2)
    printVarSummary(avgNOx)

    fon= "API20101230.nc"
    system("rm -f "+fon)
    fo = addfile(fon,"c")

    fo->avgSO2 = avgSO2
    fo->avgNOx = avgNOx
end

On 11/3/11 8:21 PM, nlcheng wrote:
> /My script is below.Each time I extract a varible that is a constant
> ,because I make its dimensions constant./
> //
> /I have to use the double circle "do " command because there is much
> count that I have omitted in this script below that it takes so much
> time to read./
> //
> /but my idea is clear . when the constant vaible is extracted I have to
> write it in the netcdf file one by one! /
> On This Premise that /do not change the the double circle "do "
> structure ,how can i /
> /write the command 。hope for your help!/
> //
> //
> //
> My idea:
> first:
> I have to define the avgSO2 and avgNOx. After the /double circle
> ,printVarSummary(SO2) or printVarSummary(NOx) /
> /that both SO2 and NOx are one dimensional .i do not want to lose the
> grid (m,n) that they have before i extract./
> /i have to use the the double circle .how can i write the script below
> .i try many times but ../
> /my script/ is below:
> ;************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/local/ncl/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
> load "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;************************************************
> begin
> fn = "/storage/sdd1/Model_Out_Data/CMAQ/2010/domain1/ln/"+"20101230.nc";
> a = addfile(fn,"r")
> fon = "API20101230.nc"
> system("rm -f "+fon)
> fo = addfile(fon,"c")
> time =12
> do m =0,159
> do n=0,199
> NO2=a->NO2(time,0,m,n)
> NO=a->NO(time,0,m,n)
> SO2=a->SO2(time,0,m,n)
> NOx =NO2+NO
>
> fo->avgSO2 = SO2
> avgSO2!0 = "ROW"
> avgSO2!1 = "COL"
> avgSO2&ROW = m
> avgSO2&COL = n
> <mailto:avgSO2@units>avgSO2
> <mailto:avgSO2@units><mailto:avgSO2@units>@units = "mg/m^3"
>
> fo->avgNOx = NOx
> avgNOx!0 = "ROW"
> avgNOx!1 = "COL"
> avgNOx&ROW = m
> avgNOx&COL = n
> <mailto:avgNOx@units>avgNOx
> <mailto:avgNOx@units><mailto:avgNOx@units>@units = "mg/m^3"
>
> end do
> end do
> end
> //
>
>
>
>
>
>
> _______________________________________________
> 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-talk
Received on Thu Nov 3 21:56:17 2011

This archive was generated by hypermail 2.1.8 : Fri Nov 04 2011 - 08:43:41 MDT