See below
> I am wondering how to set dimension information for a seconadry variable
>in Lambert Conformal Native Grid . My program is like this:
>......
>
>gridx_221 = 277
>gridy_221 = 349
>
>diri="/remote/beautemps/raid1/users/mjosman/NARR/NC/"
>
>f=addfile(diri+"narrmon-a_221_20031001.nc","r")
>LAT2d = f->gridlat_221
>LON2d = f->gridlon_221
>
>lon2d=LON2d(gridy_221|:,gridx_221|:)
>lat2d=LAT2d(gridy_221|:,gridx_221|:)
>
> P=f->PRMSL_221_MSL_113
> p = P(gridy_221|:,gridx_221|:)
> delete(P)
>
> Q=f->PRATE_221_SFC_113
> q = Q(gridy_221|:,gridx_221|:)
> delete(Q)
>
> ccr = escorc(p(50,100),q) ;***1-pt correlation***
>
>
>Now, if I want to plot "ccr", how should I set the lat and lon information
>so that it can be plotted properly. I tried something like this, but it
>failed:
>
>ccr!0="lat"
>ccr@lat=lat2d
>ccr!1="lon"
>ccr@lon=lon2d
>
>I aslo have these settings before plotting:
>
> res@mpLimitMode = "Corners" ; choose range of map
> res@mpLeftCornerLatF = lat2d@corners(0)
> res@mpLeftCornerLonF = lon2d@corners(0)
> res@mpRightCornerLatF = lat2d@corners(2)
> res@mpRightCornerLonF = lon2d@corners(2)
> res@mpProjection = "LambertConformal"
> res@mpLambertParallel1F = lat2d@Latin1 ; ncl adds from grib file
> res@mpLambertParallel2F = lat2d@Latin2 ; ncl adds from grib file
> res@mpLambertMeridianF = lat2d@Lov ; ncl adds from grib file
> res@pmTickMarkDisplayMode = "Always"
>
>
>But when I run it, the program complains there's no lat/lon information for
>plotting. And there are also warning messages like:
>
>warning:mpProjection is not a valid resource in slpMA_prcp_NARR_contour at
>this time
>warning:mpLimitMode is not a valid resource in slpMA_prcp_NARR_contour at
>this time
>warning:mpLeftCornerLonF is not a valid resource in slpMA_prcp_NARR_contour
>at this time
>warning:mpRightCornerLonF is not a valid resource in slpMA_prcp_NARR_contour
>at this time
>warning:mpLeftCornerLatF is not a valid resource in slpMA_prcp_NARR_contour
>at this time
>warning:mpRightCornerLatF is not a valid resource in slpMA_prcp_NARR_contour
>at this time
>warning:mpLambertMeridianF is not a valid resource in
>slpMA_prcp_NARR_contour at this time
>warning:mpLambertParallel1F is not a valid resource in
>slpMA_prcp_NARR_contour at this time
>warning:mpLambertParallel2F is not a valid resource in
>slpMA_prcp_NARR_contour at this time
>
>
>By the way, the information of my data file is following:
>
>~>ncdump -h narrmon-a_221_20031001.nc
>
>netcdf narrmon-a_221_20031001 {
>dimensions:
> gridx_221 = 277 ;
> gridy_221 = 349 ;
>
>variables:
> float gridlon_221(gridx_221, gridy_221) ;
> gridlon_221:corners = -145.5f, -68.320045f, -2.5698934f,
>148.64182f ;
> gridlon_221:GridType = "Lambert Conformal Secant or Tangent,
>Conical or bipolar" ;
> gridlon_221:units = "degrees_east" ;
> gridlon_221:Latin2 = 50.f ;
> gridlon_221:Latin1 = 50.f ;
> gridlon_221:Dy = 32463.f ;
> gridlon_221:Dx = 32463.f ;
> gridlon_221:Lov = -107.f ;
> gridlon_221:Lo1 = -145.5f ;
> gridlon_221:La1 = 1.f ;
> float gridlat_221(gridx_221, gridy_221) ;
> gridlat_221:corners = 1.0000008f, 0.89794505f, 46.354397f,
>46.634327f ;
> gridlat_221:GridType = "Lambert Conformal Secant or Tangent,
>Conical or bipolar" ;
> gridlat_221:units = "degrees_north" ;
> gridlat_221:Latin2 = 50.f ;
> gridlat_221:Latin1 = 50.f ;
> gridlat_221:Dy = 32463.f ;
> gridlat_221:Dx = 32463.f ;
> gridlat_221:Lov = -107.f ;
> gridlat_221:Lo1 = -145.5f ;
> gridlat_221:La1 = 1.f ;
> float PRATE_221_SFC_113(gridx_221, gridy_221) ;
> PRATE_221_SFC_113:sub_center = "The North American Regional
>Reanalysis (NARR) Project" ;
> PRATE_221_SFC_113:center = "US National Weather Service -
>NCEP (WMC)" ;
> PRATE_221_SFC_113:long_name = "Precipitation rate" ;
> PRATE_221_SFC_113:units = "kg/m^2/s" ;
> PRATE_221_SFC_113:_FillValue = -999.f ;
> PRATE_221_SFC_113:coordinates = "gridlat_221 gridlon_221" ;
> PRATE_221_SFC_113:level_indicator = 1 ;
> PRATE_221_SFC_113:grid_number = 221 ;
> PRATE_221_SFC_113:parameter_number = 59 ;
> PRATE_221_SFC_113:model = "North American Regional
>Reanalysis (NARR)" ;
> PRATE_221_SFC_113:forecast_time = 0 ;
> PRATE_221_SFC_113:initial_time = "10/01/2003 (00:00)" ;
> float PRMSL_221_MSL_113(gridx_221, gridy_221) ;
> PRMSL_221_MSL_113:sub_center = "The North American Regional
>Reanalysis (NARR) Project" ;
> PRMSL_221_MSL_113:center = "US National Weather Service -
>NCEP (WMC)" ;
> PRMSL_221_MSL_113:long_name = "Pressure reduced to MSL" ;
> PRMSL_221_MSL_113:units = "Pa" ;
> PRMSL_221_MSL_113:_FillValue = -999.f ;
> PRMSL_221_MSL_113:coordinates = "gridlat_221 gridlon_221" ;
> PRMSL_221_MSL_113:level_indicator = 102 ;
> PRMSL_221_MSL_113:grid_number = 221 ;
> PRMSL_221_MSL_113:parameter_number = 2 ;
> PRMSL_221_MSL_113:model = "North American Regional
>Reanalysis (NARR)" ;
> PRMSL_221_MSL_113:forecast_time = 0 ;
> PRMSL_221_MSL_113:initial_time = "10/01/2003 (00:00)" ;
>}
========================
"lat2d" and "lon2d" are reserved attribute names.
what is it you are tring to calculate? There is no
"time" dimension. You are trying to compute
a correlation with p(50,100) which is *one* point.
By definition, a correlation involves dividing
by a standard deviation, For one pt that is 0.
It can not be done.
If you did "ccr = escorc(p,q)" that would be an
unweighted map correlation. It would be one value.
if u had a time dimenion it would look like
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
diri = "/remote/beautemps/raid1/users/mjosman/NARR/NC/"
f = addfile(diri+"narrmon-a_221_20031001.nc","r")
LAT2d = f->gridlat_221
LON2d = f->gridlon_221
p = f->PRMSL_221_MSL_113 ; (time,gridx_221, gridy_221)
q = f->PRATE_221_SFC_113
;reorder so time is the rightmos dimension
ccr = escorc(p(gridx_221|50, gridy_221|100,time|:) \ ; one pt
,q(gridx_221|: , gridy_221|: ,time|:)) ; all pts
[SNIP ... assuming you have declared wk station and res= True]
res@mpLimitMode = "Corners" ; choose range of map
res@mpLeftCornerLatF = LAT2d@corners(0)
res@mpLeftCornerLonF = LON2d@corners(0)
res@mpRightCornerLatF = LAT2d@corners(2)
res@mpRightCornerLonF = LON2d@corners(2)
res@mpProjection = "LambertConformal"
res@mpLambertParallel1F = LAT2d@Latin1 ; ncl adds from grib file
res@mpLambertParallel2F = LAT2d@Latin2 ; ncl adds from grib file
res@mpLambertMeridianF = LAT2d@Lov ; ncl adds from grib file
res@pmTickMarkDisplayMode = "Always"
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Thu Jul 28 2005 - 16:01:38 MDT