Re: Lambert Conformal Grid

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Aug 29 2013 - 17:09:02 MDT

Hi Agnes,
You did not specify what "did not look right" about your earlier script, but I am guessing that perhaps you meant that the "native" projection does not seem to line up with the edge of the plot on the left and bottom sides of the plot.
That is because the data has missing values in those areas. I have played with your script some, eliminating the panelling and changing the variable to the first level of the PRES variable (because it's relation to the topography allows you to check the alignment with the map projection outlines). I also changed the color map and set the missing value fill color to green to make it clear which areas have missing data. I plotted both in the native projection and
in an orthographic projection. The results strongly suggest that the NCL plots are correct. I am attaching them here, along with the script, as mangled by me, so you can see how these results were obtained.
 -dave

On Aug 28, 2013, at 7:42 PM, Agnes Lim Huei Ni <alim@ssec.wisc.edu> wrote:

> Hi Dave,
>
> I apologist for the typo. I have put my code, the data and the figure that i generated in the link below.
>
> ftp://ftp.ssec.wisc.edu/pub/ssec/alim/
>
>
> Thanks
> Agnes
>
> On 8/28/13 6:47 PM, David Brown wrote:
>> It doesn't seem to be there:
>>
>> 230 Anonymous access granted, restrictions apply
>> Remote system type is UNIX.
>> Using binary mode to transfer files.
>> ftp> cd pub/alim
>> 250 CWD command successful
>> ftp> ls
>> 227 Entering Passive Mode (128,104,108,86,250,150).
>> 150 Opening ASCII mode data connection for file list
>> drwxr-xr-x 2 ftp ftp 116 Jun 14 18:31 GEO-HYPER_OSSE
>> drwxr-xr-x 5 ftp ftp 12288 Aug 27 16:15 model_levels
>> 226 Transfer complete
>> ftp> cd GEO-HYPER_OSSE
>> 250 CWD command successful
>> ftp> ls
>> 227 Entering Passive Mode (128,104,108,86,252,184).
>> 150 Opening ASCII mode data connection for file list
>> -rw-r--r-- 1 ftp ftp 231424 Apr 26 15:00 GEO-HYPER OSSE_exp_config.ppt
>> -rw-r--r-- 1 ftp ftp 54272 Apr 26 14:54 Geo-hyper_osse_experiment.doc
>> -rw-r--r-- 1 ftp ftp 13106721 Jun 14 18:31 ectc_simcot.gif
>> 226 Transfer complete
>> ftp> cd ../model_levels
>> 250 CWD command successful
>> ftp> ls
>> 227 Entering Passive Mode (128,104,108,86,213,27).
>> 150 Opening ASCII mode data connection for file list
>> -rw-r--r-- 1 ftp ftp 713735 Aug 27 16:20 Inc_1st_outer_loop.pptx
>> -rw-r--r-- 1 ftp ftp 3416576 Aug 21 04:01 Model_top_vart_res_081213.ppt
>> -rw-r--r-- 1 ftp ftp 17796 Mar 8 15:28 P.png
>> -rw-r--r-- 1 ftp ftp 13671 Mar 8 15:28 P_zoom.png
>> -rw-r--r-- 1 ftp ftp 1278464 Feb 21 2013 Vert_Res_tests.ppt
>> -rw-r--r-- 1 ftp ftp 940032 Mar 9 03:44 Vert_Res_tests_II.ppt
>> drwxr-xr-x 2 ftp ftp 12288 Jun 12 03:40 airs
>> -rw-r--r-- 1 ftp ftp 16505451 May 14 16:19 gsi_profiles
>> -rw-r--r-- 1 ftp ftp 15446618 May 23 02:13 gsi_profiles_0.5Pa
>> drwxr-xr-x 2 ftp ftp 8192 Jun 12 18:21 hirs-3
>> drwxr-xr-x 2 ftp ftp 16384 Jun 13 20:24 iasi
>> -rw-r--r-- 1 ftp ftp 15731 Mar 8 15:28 lnP.png
>> -rw-r--r-- 1 ftp ftp 10305 Jun 10 20:18 sigma_levels_0_0.01.png
>> -rw-r--r-- 1 ftp ftp 11186 Jun 10 20:18 sigma_levels_0_1.png
>> 226 Transfer complete
>> ftp> pwd
>> 257 "/pub/alim/model_levels" is the current directory
>>
>> ======
>>
>> It would be helpful to have your code and the grib file as well (unless it's a simple fix -- but I can't tell with out the picture). Thanks.
>> -dave
>>
>>
>> On Aug 28, 2013, at 5:15 PM, Agnes Lim Huei Ni <alim@ssec.wisc.edu> wrote:
>>
>>> Hi David,
>>>
>>> Thanks for clarifying what the purpose of the masking option is for.
>>>
>>> I have set my resource options to what you suggested but coordinates still does not look right.
>>> I have placed the figure at
>>> ftp.ssec.wisc.edu/pub/alim/T_test.pdf
>>>
>>> Please advise.
>>>
>>> Thanks
>>> Agnes
>>>
>>> PS The following is the code segment for the plotting.
>>>
>>> res@gsnSpreadColors = True
>>> res@mpLandFillColor = -1 ; set land to be transperant
>>> res@mpOutlineOn = True
>>> res@mpOutlineBoundarySets = "AllBoundaries"
>>> 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@mpLimitMode = "corners"
>>> res@mpLeftCornerLonF = lon2d@corners(0) ; (-168.719)
>>> res@mpLeftCornerLatF = lat2d@corners(0) ; (-8.035)
>>> res@mpRightCornerLonF = lon2d@corners(2) ; (-45.67911)
>>> res@mpRightCornerLatF = lat2d@corners(2) ; (42.22018)
>>> res@tfDoNDCOverlay = True
>>> res@cnFillOn = True
>>> res@cnLinesOn = False
>>> res@cnLineLabelsOn = False
>>> res@lbBoxLinesOn = True
>>>
>>> res@gsnAddCyclic = False
>>> res@gsnDraw=False
>>> res@gsnFrame=False
>>> res@mpEllipticalBoundary = False
>>> res@tmXBLabelFontHeightF = 0.01 ; resize tick labels
>>> res@tmYLLabelFontHeightF = 0.01
>>> res@pmTickMarkDisplayMode = "Always"
>>> res@lbLabelAutoStride = True
>>> res@lbLabelBarOn = False
>>> res@lbLabelFontHeightF=0.012
>>> res@cnLevelSelectionMode = "ExplicitLevels"
>>> res@cnLevels=(/-2.0, -1.5, -1.0, -0.5, 0.5, 1, 1.5, 2.0/)
>>>
>>> plot(0)=gsn_csm_contour_map(wks,inc(97,:,:), res)
>>> plot(1)=gsn_csm_contour_map(wks,inc(94,:,:), res)
>>> plot(2)=gsn_csm_contour_map(wks,inc(91,:,:), res)
>>> plot(3)=gsn_csm_contour_map(wks,inc(88,:,:), res)
>>> plot(4)=gsn_csm_contour_map(wks,inc(85,:,:), res)
>>> plot(5)=gsn_csm_contour_map(wks,inc(82,:,:), res)
>>>
>>> resP=True
>>> resPgsnPanelFigureStngsPerimOn=False
>>> resP@gsnPanelLabelBar = False
>>> resP@lbLabelFontHeightF=0.012
>>> resP@pmLabelBarOrthogonalPosF = -0.05
>>> resP@lbLabelStride = 1
>>> resP@gsnPanelFigureStrings= (/"a)","b)","c)","d)","e)","f)"/)
>>> gsn_panel(wks, plot, (/3,2/), resP)
>>> gsnMaximize = True
>>>
>>>
>>> On 8/28/13 4:53 PM, David Brown wrote:
>>>> Agnes (and Rick):
>>>> Well the model this GRIB is associated with is the "North Pacific Hurricane Wave Model" so it seems natural that it is centered over the Pacific. I am attaching a plot of the area covered by the data as
>>>> specified in the GRIB lat/lon coordinate attributes. As the message indicates, the error stems from attempting to mask the conformal projection. The masking routine expects the plot to lie solely in the Northern or Southern
>>>> hemisphere. That is because its purpose is to remove the "hole" in the projection that occurs wrapping around the pole. See the two frames of the first plot in the masked LC example page if this is not clear (http://www.ncl.ucar.edu/Applications/lcmask.shtml).
>>>>
>>>> For a regional LC projection that does not include the polar area, there is no need to mask the projection.
>>>> So the first suggestion is to remove:
>>>> res@gsnMaskLambertConformal = True
>>>>
>>>> Second if you set up the projection based on the lat/lon variable attributes in the GRIB file you can do a "native" projection, which is faster and presents the data as the GRIB producer output it.
>>>> The projection resources you would use are:
>>>>
>>>> res@mpProjection = "lambertconforma
>>>> res@mpLambertParallel1F = lat2d@Latin1 ; (36.228)
>>>> res@mpLambertParallel2F = lat2d@Latin2 ; (36.228)
>>>> res@mpLambertMeridianF" : lat2d@Lov ; (-122.246)
>>>> res@mpLimitMode = "corners"
>>>> res@mpLeftCornerLonF = lon2d@corners(0) ; (-168.719)
>>>> res@mpLeftCornerLatF = lat2d@corners(0) ; (-8.035)
>>>> res@mpRightCornerLonF = lon2d@corners(2) : (-45.67911)
>>>> res@mpRightCornerLatF = lat2d@corners(2) ; (42.22018)
>>>>
>>>> Additionally set
>>>>
>>>> res@tfDoNDCOverlay = True
>>>>
>>>> and don't use the lat2d, lon2d coordinate attributes.
>>>>
>>>> However, you can use any projection for this data if you don't set tfDoNDCOverlay and do use the lat2d, lon2d coordinates.
>>>>
>>>> Hope this helps.
>>>> -dave
>>>> <Mail Attachment.png>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Aug 28, 2013, at 1:31 PM, Rick Brownrigg <brownrig@ucar.edu> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I don't know about the source of the error message, but what strikes me is the value for mpLambertMeridianF is somewhat unusual for a map of CONUS: a value of -125 puts the center of projection off the coast of California. A value of -98 would be more typical.
>>>>>
>>>>> Just FWIW
>>>>> Rick
>>>>>
>>>>> On Aug 28, 2013, at 1:21 PM, Agnes Lim Huei Ni <alim@ssec.wisc.edu> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have a grb file that contains temperature covering CONUS and part
>>>>>> south america.
>>>>>> I had set the following resources to plot it on a lambert conformal grid
>>>>>> res@mpProjection = "LambertConformal"
>>>>>> res@mpLambertParallel1F = 20.000
>>>>>> res@mpLambertParallel2F = 40.000
>>>>>> res@mpLambertMeridianF = -125.000
>>>>>> res@gsnMaskLambertConformal = True
>>>>>>
>>>>>> The following errors appear
>>>>>> (0) mask_lambert_conformal: warning: you are not authorized to specify.
>>>>>> (0) a maxlat that is above the equator and a minlat that is below
>>>>>> (0) the equator. No masking will take place.
>>>>>>
>>>>>> The information in the grb file for T, latitude and longitude in the
>>>>>> data file are listed belowe.
>>>>>>
>>>>>> Please advice.
>>>>>>
>>>>>> Thanks
>>>>>> Agnes
>>>>>>
>>>>>> Variable: anal_T
>>>>>> Type: float
>>>>>> Total Size: 479364732 bytes
>>>>>> 119841183 values
>>>>>> Number of Dimensions: 3
>>>>>> Dimensions and sizes: [lv_HYBL0 | 99] x [g3_x_1 | 869] x [g3_y_2 | 1393]
>>>>>> Coordinates:
>>>>>> lv_HYBL0: [1..99]
>>>>>> Number Of Attributes: 13
>>>>>> center : US National Weather Service - NCEP (WMC)
>>>>>> long_name : Temperature
>>>>>> units : K
>>>>>> _FillValue : 1e+20
>>>>>> coordinates : g3_lat_1 g3_lon_2
>>>>>> level_indicator : 109
>>>>>> gds_grid_type : 3
>>>>>> parameter_table_version : 2
>>>>>> parameter_number : 11
>>>>>> model : North Pacific Hurricane Wave Model
>>>>>> forecast_time : 0
>>>>>> forecast_time_units : hours
>>>>>> initial_time : 05/24/2008 (00:00)
>>>>>>
>>>>>> Variable: lat2d
>>>>>> Type: float
>>>>>> Total Size: 4842068 bytes
>>>>>> 1210517 values
>>>>>> Number of Dimensions: 2
>>>>>> Dimensions and sizes: [g3_x_1 | 869] x [g3_y_2 | 1393]
>>>>>> Coordinates:
>>>>>> Number Of Attributes: 11
>>>>>> corners : ( -8.035, -5.586509, 42.22018, 36.89176 )
>>>>>> long_name : latitude
>>>>>> GridType : Lambert Conformal Secant or Tangent, Conical or bipolar
>>>>>> units : degrees_north
>>>>>> Latin2 : 36.228
>>>>>> Latin1 : 36.228
>>>>>> Dy : 7920
>>>>>> Dx : 8774
>>>>>> Lov : -122.246
>>>>>> Lo1 : -168.719
>>>>>> La1 : -8.035
>>>>>>
>>>>>> Variable: lon2d
>>>>>> Type: float
>>>>>> Total Size: 4842068 bytes
>>>>>> 1210517 values
>>>>>> Number of Dimensions: 2
>>>>>> Dimensions and sizes: [g3_x_1 | 869] x [g3_y_2 | 1393]
>>>>>> Coordinates:
>>>>>> Number Of Attributes: 11
>>>>>> corners : ( -168.719, -80.83456, -45.67911, 154.7749 )
>>>>>> long_name : longitude
>>>>>> GridType : Lambert Conformal Secant or Tangent, Conical or bipolar
>>>>>> units : degrees_east
>>>>>> Latin2 : 36.228
>>>>>> Latin1 : 36.228
>>>>>> Dy : 7920
>>>>>> Dx : 8774
>>>>>> Lov : -122.246
>>>>>> Lo1 : -168.719
>>>>>> La1 : -8.035
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>
>>>
>>> _______________________________________________
>>> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Aug 29 17:09:14 2013

This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT