Re: Plotting Irregular Grid data using lat2d lon2d

From: <malmistry_at_nyahnyahspammersnyahnyah>
Date: Fri, 22 Aug 2008 02:20:35 +0530 (IST)

Mary,
Many thanks (both for approving my request and also the solution). I have made the changes as advised and the variable 'hsl_1' now does use glat_1 and glon_1 on the X/Y axes. However, I still have a doubt on this method used and whether it is actually doing the right thing.

'glat' and 'glong' are a function of (lat,long) in the netcdf file created by me...my doubts are:

(a) What do '@lat2d' and '@lon2d' exactly do in the ncl script?

(b) How do I ascertain that my file is indeed an 'irregular grid' problem and not a 'native grid' problem?

To give you a bit of history...My original task was to create a simple netcdf file from a model output ('.dat') file. The model uses a rotated lat/long (Arakawa B) grid. glat and glon are created by me (in netcdf file) by converting the rotated lat/long to the model cartesian lat/long.

So I wonder whether having a rotated lat/long grid in the original model output file does make my netcdf file a native grid file (I read about the different projections on NCL website and don't think 'Rotated lat/long' falls under these projections).

I hope I have been clear in explaining my doubts..

Thank you once again.
Malcolm
Barcelona Supercomputing Center (BSC)

----- Original Message -----
From: Mary Haley <haley_at_ucar.edu>
To: malmistry_at_indiatimes.com
Cc: ncl-talk-owner_at_ucar.edu
Sent: Thu, 21 Aug 2008 03:05:35 +0530 (IST)
Subject: Re: Plotting Irregular Grid data using lat2d lon2d

> Hello!
> I hope you can help..I am basically trying to plot an output variable "hsl". The model grid is Arakawa B-Grid (of NCEP UMO Model). I have created a netcdf file in fortran, the ncdump -h is below:
>
> {
> dimensions:
> west_east = 771 ;
> south_north = 543 ;
> bottom_top = 30 ;
> nwets = 4 ;
> variables:
> float glat(south_north, west_east) ;
> float glon(south_north, west_east) ;
> float hsl(bottom_top, south_north, west_east) ;
> hsl:units = "units" ;
> hsl:title = "Hsl-UMO" ;
> hsl:long_name = "Hsl-UMO" ;
> }
>
> glat and glat are the model grid (X,Y) axis against which hsl needs to be plotted (projected). glat and glon are from (-90 to +90) and (-180 to 180)...respectively
>
> I believe this is NOT A NATIVE GRID issue...but an irregular grid issue. I have read all the info on Native/Irregular grid on the website...yet unable to do this.
>
> Below is my .ncl script. I have followed the exact method from page 19 (graphics manual from website)...

I think what you need to do is add the following:

   res = True ; To set up a resource list
   res_at_sfXArray = glon
   res_at_sfYArray = glat
   plot = gsn_contour(xwks,hsl_1,res) ; Draw a contour plot.

There's no way for NCL to know that it is supposed to use "glat" and
"glon" on the X and Y axes, so the above two lines should do it. Note
also that the third argument to gsn_contour has changed to "res".

I've approved your ncl-talk request. You should be able to post
following questions to ncl-talk_at_ucar.edu.

--Mary

> The script DOES NOT plot "hsl" against glat and glon...instead it continues to plot "hsl" against 'west-east' (0-771 scale) and 'south_north' (0-543 scale).
>
> --------------------------------------
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
> cdf_file = addfile("/home/malcolm/BSC/UMO/pout_g_test000.nc","r")
>
> glat_1 = cdf_file->glat
> glon_1 = cdf_file->glon
>
> hsl_1 = cdf_file->hsl(0,:,:) ; hsl is read from input file and assigned to hsl_1
>
> hsl_1_at_lon2d = glon_1
> hsl_1_at_lat2d = glat_1
>
> xwks = gsn_open_wks("x11","pout_g_test000") ; Open an X11 workstation.
>
> plot = gsn_contour(xwks,hsl_1,False) ; Draw a contour plot.
>
> delete(plot) ; Clean up.
> delete(hsl_1)
>
> end
> --------------------------------------
>
> Many Thanks
> Malcolm
> Barcelona Super Computing center
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Aug 21 2008 - 14:50:35 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 25 2008 - 15:23:45 MDT