Re: Data from a Lambert native grid reprojected on a Mercator grid.

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Fri Jan 29 2010 - 10:57:24 MST

Hi Caroline,

I am just going to address you second attempt:
On Jan 29, 2010, at 2:22 AM, Caroline Serraud wrote:

In this case the data you are drawing is still in the native grid. It
has not been interpolated to a lat/lon grid. Therefore, drawing code
needs to know the location of each data point individually, meaning
that you still need to use the complete coordinate arrays that are
produced by the 'ndctodata' loop. In other words, the sfXArray and
sfYArray resources should be set as in the example, regardless of
projection you ultimately use for your plot.
  -dave

>
> Then I tried to follow the http://www.ncl.ucar.edu/Applications/Scripts/native_5.ncl
> script exemple, but as I want a final mercator projection, so with
> one-dimensional arrays that specifies the latitude and longitude
> coordinates of the grid instead of two-dimensional in the exemple,
> I made some changes:
>
> res@mpProjection = "LambertConformal"
> res@mpLimitMode = "Corners"
> res@mpLeftCornerLatF = lat2d@corners(0)
> res@mpLeftCornerLonF = lon2d@corners(0)
> res@mpRightCornerLatF = lat2d@corners(2)
> res@mpRightCornerLonF = lon2d@corners(2)
> res@mpLambertParallel1F = lat2d@Latin1
> res@mpLambertParallel2F = lat2d@Latin2
> res@mpLambertMeridianF = lat2d@Lov
>
> res@tfDoNDCOverlay = True
> res@gsnDraw = False
>
> plot=gsn_csm_contour_map(wks,tt,res)
>
> getvalues plot
> "vpXF" : x
> "vpYF" : y
> "vpWidthF" : w
> "vpHeightF" : h
> end getvalues
> print("x: " + x + " y: " + y + " w: " + w + " h: " + h)
>
> ndcx = fspan(x, x + w,nlon)
> ndcy = fspan(y-h,y,nlat)
>
> eps = 5e-7
> ndcx(0) = ndcx(0) + eps
> ndcx(nlon-1) = ndcx(nlon -1) - eps
> ndcy(0) = ndcy(0) + eps
> ndcy(nlat-1) = ndcy(nlat -1) - eps
>
> print( "calculating lat/lon fields")
> tndcy = new(nlon, float)
> outlat = new((/nlat,nlon/), float)
> outlon = new((/nlat,nlon/), float)
>
> do i = 0, nlat-1
> tndcy = ndcy(i)
> ndctodata(plot,ndcx,tndcy,outlon(i,:),outlat(i,:))
> end do
>
> res@mpProjection = "mercator"
> res@mpLimitMode = "LatLon"
> res@mpMinLatF = 40
> res@mpMaxLatF = 50.3
> res@mpMinLonF = -8.02
> res@mpMaxLonF = 20.82
> res@mpMinLonF = i_lon_min
> res@mpMaxLonF = i_lon_max
>
> res@tfDoNDCOverlay = False
>
> res@gsnAddCyclic = False
> res@sfXArray = outlon(nlat-1,:)
> res@sfYArray = outlat(:,nlon-1)
>
> plot=gsn_csm_contour_map(wks,tt,res)
> end
>
>
>
> But my Postscript output is empty.
> The ncdump output of my input file is like this:
> netcdf \2010013023 {
> dimensions:
> g3_x_0 = 339 ;
> g3_y_1 = 437 ;
> variables:
> float g3_lon_1(g3_x_0, g3_y_1) ;
> g3_lon_1:La1 = 34.449f ;
> g3_lon_1:Lo1 = -10.703f ;
> g3_lon_1:Lov = 6.25f ;
> g3_lon_1:Dx = 6955.f ;
> g3_lon_1:Dy = 7040.f ;
> g3_lon_1:Latin1 = 46.8f ;
> g3_lon_1:Latin2 = 46.8f ;
> g3_lon_1:units = "degrees_east" ;
> g3_lon_1:GridType = "Lambert Conformal Secant or
> Tangent, Conical or bipolar" ;
> g3_lon_1:long_name = "longitude" ;
> g3_lon_1:corners = -10.703f, 21.93901f, 29.32028f,
> -18.61473f ;
> float g3_lat_0(g3_x_0, g3_y_1) ;
> g3_lat_0:La1 = 34.449f ;
> g3_lat_0:Lo1 = -10.703f ;
> g3_lat_0:Lov = 6.25f ;
> g3_lat_0:Dx = 6955.f ;
> g3_lat_0:Dy = 7040.f ;
> g3_lat_0:Latin1 = 46.8f ;
> g3_lat_0:Latin2 = 46.8f ;
> g3_lat_0:units = "degrees_north" ;
> g3_lat_0:GridType = "Lambert Conformal Secant or
> Tangent, Conical or bipolar" ;
> g3_lat_0:long_name = "latitude" ;
> g3_lat_0:corners = 34.449f, 34.66832f, 55.32279f,
> 55.00012f ;
> float g3_rot_2(g3_x_0, g3_y_1) ;
> g3_rot_2:note2 = "apply formulas to derive u and v
> components relative to earth" ;
> g3_rot_2:note1 = "u and v components of vector
> quantities are resolved relative to grid" ;
> g3_rot_2:formula_v = "Vearth = cos(rot)*Vgrid -
> sin(rot)*Ugrid" ;
> g3_rot_2:formula_u = "Uearth = sin(rot)*Vgrid +
> cos(rot)*Ugrid" ;
> g3_rot_2:units = "radians" ;
> g3_rot_2:GridType = "Lambert Conformal Secant or
> Tangent, Conical or bipolar" ;
> g3_rot_2:long_name = "vector rotation angle" ;
> float TMP_GDS3_HTGL_10(g3_x_0, g3_y_1) ;
> TMP_GDS3_HTGL_10:initial_time = "01/27/2010 (00:00)" ;
> TMP_GDS3_HTGL_10:forecast_time_units = "hours" ;
> TMP_GDS3_HTGL_10:forecast_time = 28094 ;
> TMP_GDS3_HTGL_10:level = 2 ;
> TMP_GDS3_HTGL_10:parameter_number = 11 ;
> TMP_GDS3_HTGL_10:parameter_table_version = 3 ;
> TMP_GDS3_HTGL_10:gds_grid_type = 3 ;
> TMP_GDS3_HTGL_10:level_indicator = 105 ;
> TMP_GDS3_HTGL_10:coordinates = "g3_lat_0 g3_lon_1" ;
> TMP_GDS3_HTGL_10:_FillValue = 1.e+20f ;
> TMP_GDS3_HTGL_10:units = "K" ;
> TMP_GDS3_HTGL_10:long_name = "Temperature" ;
> TMP_GDS3_HTGL_10:center = "French Weather Service -
> Toulouse" ;
>
> }
>
> Am I doing something wrong?
> Any remark would be very helpful!!
>
> Thanks in advance for your time
> Caroline
> --
> Caroline Serraud - Ingénieur Développement
> ------------------------------------------------------
> METEO CONSULT / La Chaine Météo - Groupe Figaro
> Département Informatique
> Domaine de Marsinval F-78540 Vernouillet, FRANCE
> Tél : 01 39 28 1990 - Fax : 01 39 71 85 31
> e-mail : cs@meteoconsult.fr
> ------------------------------------------------------
> Toute la météo sur le Web : http://www.meteoconsult.fr
> Toute la météo par téléphone : 3201
> _______________________________________________
> 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 Fri Jan 29 10:57:31 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 01 2010 - 08:05:34 MST