Once you calculate the new latitude values you need to replace the
lat coordinate values in your
variables. Note that these are 1D coordinate variables.
So where you have this:
> badlat = afile->g0_lat_0
> latdiff = badlat_at_La1 - badlat
>
> lat2d = badlat_at_La1 + latdiff
try this:
badlat = afile->g0_lat_0
latdiff = badlat_at_La1 - badlat
lat = badlat_at_La1 + latdiff
ugrd&g0_lat_0 = lat
vgrd&g0_lat_0 = lat
I think this should be enough to get your example working.
-dave
On Nov 17, 2008, at 10:44 AM, Jin-Young Kim wrote:
> Thanks you for your kind comment..
>
> I could draw exact map ..
> but i could not express the data..
>
> Would you give me comment more?
>
> ;/opt/ncl/5.0.0_bin/bin/
> ;/opt/ncl/5.0.0_bin/bin/ncl_filedump
> ;/opt/ncl/5.0.0_bin/bin/ncl_convert2nc
> ;/opt/ncl/5.0.0_intel_9.1/bin
>
> 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/shea_util.ncl"
>
> begin
>
> dir = "../DENNIS04L.2005070700/PSTP/postprd/"
>
> ifim = sprinti("wrfprs_d01.%0.2i"+".grb",ispan(0,72,6))
> ofim = sprinti("strm200_d01h_%0.2i",ispan(0,72,6))
> titl = sprinti("%0.2i",ispan(0,72,6))
>
> ;************************************************
> ; Use WRF_contributed procedure to set map resources
> ;************************************************ do i= 0, dimsizes
> (ifim)-1
>
> afile = addfile(dir+ifim(i),"r")
> psfc = afile->PRMSL_GDS0_MSL
> psfc = psfc*0.01
> psfc_at_units = "hPa" ; Pa
>
> u10m = afile->U_GRD_GDS0_HTGL
> ugrd = afile->U_GRD_GDS0_ISBL(14,:,:) ; 200hPa
> ;u900 = afile->U_GRD_GDS0_ISBL(42,:,:) ; 900hPa
> u10m_at_units = "m/s" ; m/s
>
> v10m = afile->V_GRD_GDS0_HTGL
> vgrd = afile->V_GRD_GDS0_ISBL(14,:,:) ; 200hPa
> ;v900 = afile->V_GRD_GDS0_ISBL(42,:,:) ; 900hPa
> v10m_at_units = "m/s" ; m/s
>
> ;************************************************
> badlat = afile->g0_lat_0
> latdiff = badlat_at_La1 - badlat
>
> lat2d = badlat_at_La1 + latdiff
> lon2d = afile->g0_lon_1
> ;************************************************
>
> ;=============================
> ; create lat and long coordinate variables
> ;============================
> lon2d!0 = "lon"
> lon2d_at_long_name = "lon"
> lon2d_at_units = "degrees-east"
> lon2d&lon = lon2d
>
> lat2d!0 = "lat"
> lat2d_at_long_name = "lat"
> lat2d_at_units = "degrees_north"
> lat2d&lat = lat2d
>
>
> ; wind=sqrt(u10m*u10m+v10m*v10m)
> wind=sqrt(ugrd*ugrd+vgrd*vgrd)
>
> printVarSummary(ugrd)
> nMsg=num(ismissing(ugrd))
> print("nMsg="+nMsg)
> ;************************************************
> wks =gsn_open_wks("ps",ofim(i))
> ; gsn_define_colormap(wks,"gui_default")
>
> rescn = True
> rescn_at_tiMainString = "Streamline " + titl(i) + "h Fcst.";title
> rescn_at_pmTickMarkDisplayMode = "Always" ; turn
> on tick marks
>
> rescn_at_gsnAddCyclic = False ; regional
> data, don't add pt
> rescn_at_mpMinLatF = min(lat2d)
> rescn_at_mpMinLonF = min(lon2d)
> rescn_at_mpMaxLatF = max(lat2d)
> rescn_at_mpMaxLonF = max(lon2d)
> ; rescn_at_mpMinLatF = min(ugrd&g0_lat_0)
> ; rescn_at_mpMinLonF = min(ugrd&g0_lon_1)
> ; rescn_at_mpMaxLatF = max(ugrd&g0_lat_0)
> ; rescn_at_mpMaxLonF = max(ugrd&g0_lon_1)
> rescn_at_stArrowLengthF = 0.004 ; size of the
> arrows.
> rescn_at_stMinArrowSpacingF = 0.004 ; arrow spacing.
> rescn_at_stArrowStride = 3 ; arrows
> start every third
> rescn_at_stLineThicknessF = 0.5 ; arrows
> start every third
>
> plotu=gsn_csm_streamline_map_ce(wks,ugrd(::3,::3),vgrd(::
> 3,::3),rescn)
>
> end do
> end
>
> Beset regards,
> Jin-Young Kim
>
>
>
>
>
> On Fri, Nov 14, 2008 at 1:54 PM, David Brown <dbrown_at_ucar.edu> wrote:
> Hi Jin-Young Kim,
>
> The problem is that octet 28 of the GDS in this file has the
> scanning mode for the lat (y) axis set to scan in the -j direction.
> See http://www.nco.ncep.noaa.gov/pmb/docs/on388/table8.html
>
> But this contradicts the fact that the la1 value is less than the
> la2 value, which should mean that the scanning direction
> would be positive.
>
> This octet is set to decimal 0, meaning bit 2 (counting from the
> "big" end of the byte) is 0. It should, (at least if it were like
> all the GRIB files
> we have encountered up to now where the la1 value is less than the
> la2 value) have the value 64 (binary 0100 0000).
>
> NCL has the correct values for la1 and la2 in its attributes, but
> it relies on the scanning direction to calculate the actual
> coordinate values starting from la1. This means it goes away from
> la2 rather than towards it.
> Note that wgrib does not actually calculate the coordinates. It
> just gives the values of la1 and la2, which agree with NCL.
> It also shows that "scan" is 0, which means that it agrees that the
> Y axis scanning direction is negative.
>
> Admittedly NCL does not check the coordinates to see whether the
> la2 value agrees with the end coordinate it gets and
> perhaps it should. It could put out an error message that there is
> a contradiction in the GDS and then favor getting the
> direction by checking whether la2 - la1 is pos or neg.
>
> But I would have to say that the grib writer that is outputting the
> data is creating an incorrect GDS for each record.
>
> As a workaround I think the correct latitude values can be obtained
> for this file with the following calculation
>
> badlat = f->g0_lat_0
> latdiff = badlat_at_La1 - badlat
> lat = badlat_at_La1 + latdiff
>
> or in a single calculation:
> lat = 2 * badlat_at_La1 - badlat
>
> Using these lat values you get a good alignment with the map
> outlines for the PRES_GDS0_SFC variable, so I think
> this is correct.
>
> -dave
>
> On Nov 13, 2008, at 3:04 PM, Jin-Young Kim wrote:
>
>> Thanks for replying.
>> Would you look at blue characters?
>>
>> On Fri, Nov 14, 2008 at 5:20 AM, WRF Help <wrfhelp_at_ucar.edu> wrote:
>> Hi,
>>
>> I apologize, but I am not clear on exactly what you are saying
>> here. Let me see if I can restate it to you to see if I am on the
>> right track. Are you saying that when you print the lat/lon
>> information from NCL you get:
>>
>>
>> g0_lat_0 = [-8.753..-64.193]
>> g0_lon_1 = [-103.249..-46.369]
>>
>> but those are not the values in the wrfpost grib file? What are
>> the values in the grib file? (Try wgrib -V). Are you using the
>> automated copygb_hwrf.txt file or are you setting the values for
>> copygb yourself?
>>
>> Those values in the wrfpost grib file via ncl scripts.
>> when i do "getfilevarnames(wrfprs_d02.00)" in ncl scripts,
>> it's showing g0_lat_0, g0_lon_1 with level information.
>> But when i do wgrib -V,
>> it looks same as latlon: lat -8.753000 to -46.687000
>> long -103.249000 to -46.369.
>> I think ncl could not recognize grib information exactly.
>> What do you recommend to me?
>>
>> I've used automated copygb-hwrf.txt file in the WPPV3.
>>
>>
>> Or are you saying that it does not match the grid you entered in
>> to start with for WPS? It will not match exactly after it has
>> been put through copygb.
>>
>> I think grib output information is correct even though it
>> postprocess with WPP.
>> I think NCL could not read correct information because of WPP
>> included missing values.
>> It's just my opinion.
>>
>>
>> I still see you have those stripes running through your image.
>> There appears to be something wrong with your run. Have you looked
>> into that?
>>
>> --wrfhelp
>>
>>
>> About results,, i'm still look at with other person..
>> Thanks
>>
>> Best regards,
>> Jin-Young Kim
>>
>>
>> On Thu, 13 Nov 2008 06:40:43 +0900
>>
>> "Jin-Young Kim" <ruwiejin_at_gmail.com> wrote:
>> missed attach file
>>
>> ---------- Forwarded message ----------
>> From: Jin-Young Kim <ruwiejin_at_gmail.com>
>> Date: Thu, Nov 13, 2008 at 6:37 AM
>> Subject: Re: vertical cross section with wpp output by
>> To: WRF Help <wrfhelp_at_ucar.edu>
>>
>>
>> I've used copygb for lan-lon projection. After wrfpostandgrads
>> output figure
>> is attached.
>>
>> I'm curious for latitude information when i read ncl scripts.
>>
>> g0_lat_0 = [-8.753..-64.193]
>> g0_lon_1 = [-103.249..-46.369]
>>
>> so latitude is different..
>> Should i think ncl wrfpost should right or not?
>> Then it does not match with my configuration.
>>
>> How do you think about this?
>> Please give me comment..
>>
>> Thanks
>>
>> Jin-Young Kim
>>
>>
>>
>>
>>
>> On Thu, Nov 13, 2008 at 5:34 AM, WRF Help <wrfhelp_at_ucar.edu> wrote:
>>
>> I have used NCL to create images after running through WPP,
>> however I have
>> never done vertical/horizontal cross-sections through the data so
>> I do not
>> have any sample scripts to send your way. One option would be to
>> post to
>> the wrf_users_at_ucar.edu email to see if any users have any examples
>> they
>> are willing to share.
>>
>> Are you using copygb? What type of projection are you writing out?
>>
>> --wrfhelp
>>
>> On Wed, 12 Nov 2008 10:57:18 -0700
>>
>> "Jin-Young Kim" <ruwiejin_at_gmail.com> wrote:
>>
>> Dear WRFHELP,
>>
>> I've recognized my problem..
>>
>> When i read WPP output with NCL scripts..
>> lat /longitude does not match with actual latitude and logitude.
>> It might be actual latitude and longitude?!
>> Anyway i've been finding wrong latitude..
>>
>> when i check wppandgrads information,
>> ctl has been check right lat/long to be able to capture correct
>> figure
>> at the correct position.
>>
>> Is there anybody to use WRF NMM output after WPP package..
>> and draw NCL ?
>> Would you send me example scripts to draw
>> horizontal and vertical cross section ?
>>
>> Thanks
>>
>> Jin-Young Kim
>>
>> On Tue, Nov 11, 2008 at 2:54 PM, Jin-Young Kim <ruwiejin_at_gmail.com>
>> wrote:
>>
>> Greetings WRFHELP,
>> I have problem to use WRFPOST data to draw vertical cross section.
>>
>> 1) i would like to draw certain latitude cross section.
>> so i've write with referring ncl example script..
>> but WRFpost output does not applied. Would you look at red line?
>>
>> Here is scripts
>>
>> ;/opt/ncl/5.0.0_bin/bin/
>> ;/opt/ncl/5.0.0_bin/bin/ncl_filedump
>> ;/opt/ncl/5.0.0_bin/bin/ncl_convert2nc
>> ;/opt/ncl/5.0.0_intel_9.1/bin
>> ;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
>>
>> 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/shea_util.ncl"
>>
>> begin
>>
>>
>> dir = "../DENNIS04L.2005070700/PSTP/postprd/"
>>
>> ifim = sprinti("wrfprs_d02.%0.2i"+".grb",ispan(24,30,6))
>> ofim = sprinti("windx_d02h_%0.2i",ispan(24,30,6))
>> titl = sprinti("%0.2i",ispan(24,30,6))
>>
>> do i= 0, dimsizes(ifim)-1
>>
>> grb_file = addfile(dir+ifim(i),"r")
>> names = getfilevarnames (grb_file)
>> print (names)
>>
>> psfc = grb_file->PRMSL_GDS0_MSL(:, :)
>> psfc = psfc*0.01
>> psfc_at_units = "hPa" ; Pa
>>
>> u10m = grb_file->U_GRD_GDS0_HTGL(:, :)
>> ugrd = grb_file->U_GRD_GDS0_ISBL(:, :,:)
>> u10m_at_units = "m/s" ; m/s
>>
>> v10m = grb_file->V_GRD_GDS0_HTGL(:, :)
>> vgrd = grb_file->V_GRD_GDS0_ISBL(:, :,:)
>> v10m_at_units = "m/s" ; m/s
>>
>> wind=sqrt(ugrd*ugrd+vgrd*vgrd)
>> ************************************************
>> wks =gsn_open_wks("ps",ofim(i))
>> gsn_define_colormap(wks,"gui_default")
>>
>> res = True
>> res_at_cnFillOn = True
>> res_at_tiMainString = "Wind Speed (m/s) " + titl(i) + "h
>> Fcst.";title
>> res_at_cnLevelSpacingF = 5. ; contour spacing
>>
>> ; ({700},{-30:50},{ 135:270})
>> plot=gsn_csm_contour(wks,ugrd(:,{19.4:19.4},:),res) ; lattitude 19.4
>> degree
>> ; plot=SahdeGtContour(plot,-999,10)
>> ; opt = True
>> ; opt_at_gsnShadeFillType = "Pattern"
>> ; opt_at_gsnShadeHigh = 100
>>
>> ; plot=gsn_csm_contour_shade(plot,-999,25,opt)
>>
>> 2) i would do inverse vertical level also.
>> when i draw original data .. it stack from higher level(200mb) to
>> lower level(1000mb).
>> Do you know anybody this part?
>>
>> Best regards,
>> Jin-Young Kim
>> --
>> Ph. D. Student
>> Jin-Young Kim (jin_at_climate.pknu.ac.kr)
>> Integrated Climate System Modeling Lab.
>> Department of Environmental Atmospheric Sciences
>> Pukyong National University, Busan 608-737, South Korea
>> Web : http:climate.pknu.ac.kr/~jin <http://climate.pknu.ac.kr/%7Ejin>
>>
>> Visiting Scholar
>> Jin-Young Kim (Jin-Young.Kim_at_noaa.gov)
>> Global Systems Division
>> Earth System Research Laboratory
>> R/GSD7
>> 325 Broadway
>> Boulder, CO80305-3328
>>
>> +1-303- 497-4422 (Office)
>> +1-303- 497-7262 (FAX)
>>
>>
>>
>>
>> --
>> Ph. D. Student
>> Jin-Young Kim (jin_at_climate.pknu.ac.kr)
>> Integrated Climate System Modeling Lab.
>> Department of Environmental Atmospheric Sciences
>> Pukyong National University, Busan 608-737, South Korea
>> Web : http:climate.pknu.ac.kr/~jin
>>
>> Visiting Scholar
>> Jin-Young Kim (Jin-Young.Kim_at_noaa.gov)
>> Global Systems Division
>> Earth System Research Laboratory
>> R/GSD7
>> 325 Broadway
>> Boulder, CO80305-3328
>>
>> +1-303- 497-4422 (Office)
>> +1-303- 497-7262 (FAX)
>>
>>
>>
>>
>>
>> --
>> Ph. D. Student
>> Jin-Young Kim (jin_at_climate.pknu.ac.kr)
>> Integrated Climate System Modeling Lab.
>> Department of Environmental Atmospheric Sciences
>> Pukyong National University, Busan 608-737, South Korea
>> Web : http:climate.pknu.ac.kr/~jin
>>
>> Visiting Scholar
>> Jin-Young Kim (Jin-Young.Kim_at_noaa.gov)
>> Global Systems Division
>> Earth System Research Laboratory
>> R/GSD7
>> 325 Broadway
>> Boulder, CO80305-3328
>>
>> +1-303- 497-4422 (Office)
>> +1-303- 497-7262 (FAX)
>>
>>
>>
>> --
>> Ph. D. Student
>> Jin-Young Kim (jin_at_climate.pknu.ac.kr)
>> Integrated Climate System Modeling Lab.
>> Department of Environmental Atmospheric Sciences
>> Pukyong National University, Busan 608-737, South Korea
>> Web : http:climate.pknu.ac.kr/~jin
>>
>> Visiting Scholar
>> Jin-Young Kim (Jin-Young.Kim_at_noaa.gov)
>> Global Systems Division
>> Earth System Research Laboratory
>> R/GSD7
>> 325 Broadway
>> Boulder, CO80305-3328
>>
>> +1-303- 497-4422 (Office)
>> +1-303- 497-7262 (FAX)
>>
>>
>>
>>
>> --
>> Ph. D. Student
>> Jin-Young Kim (jin_at_climate.pknu.ac.kr)
>> Integrated Climate System Modeling Lab.
>> Department of Environmental Atmospheric Sciences
>> Pukyong National University, Busan 608-737, South Korea
>> Web : http:climate.pknu.ac.kr/~jin
>>
>> Visiting Scholar
>> Jin-Young Kim (Jin-Young.Kim_at_noaa.gov)
>> Global Systems Division
>> Earth System Research Laboratory
>> R/GSD7
>> 325 Broadway
>> Boulder, CO80305-3328
>>
>> +1-303- 497-4422 (Office)
>> +1-303- 497-7262 (FAX)
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> --
> Ph. D. Student
> Jin-Young Kim (jin_at_climate.pknu.ac.kr)
> Integrated Climate System Modeling Lab.
> Department of Environmental Atmospheric Sciences
> Pukyong National University, Busan 608-737, South Korea
> Web : http:climate.pknu.ac.kr/~jin
>
> Visiting Scholar
> Jin-Young Kim (Jin-Young.Kim_at_noaa.gov)
> Global Systems Division
> Earth System Research Laboratory
> R/GSD7
> 325 Broadway
> Boulder, CO80305-3328
>
> +1-303- 497-4422 (Office)
> +1-303- 497-7262 (FAX)
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Nov 17 2008 - 12:27:37 MST
This archive was generated by hypermail 2.2.0 : Wed Nov 19 2008 - 10:42:49 MST