Re: ِAscii data coordinate adjusting

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Sat Feb 26 2011 - 16:44:35 MST

You need to generate proper coordinate variables for latitude and
longitude, and attach them to your data variable "vwnd". This
method is shown in example 2 on this page:

http://www.ncl.ucar.edu/Document/Functions/Built-in/generate_2d_array.shtml

Use *only* the 8 program statements following this comment:
"Generate 1D lat/lon coord arrays and attach to data." lat1, lat2,
lon1, lon2 are placed within the two fspan function calls.

Also, it is good practice to set the following variables at the top
of your program, and never use explicit constants after these
statements:

   nx = 144
   ny = 73
   lat1 = ...
   lat2 = ...
   lon1 = ...
   lon2 = ...

--Dave

On 2/26/2011 4:06 PM, ahmed lasheen wrote:
> Hello
> I have NC file which contain data about wind , and i wish to make
> some calculation on it so i have print
> to ASCII file and then plot it to ensure that i am reading
> it correctly , but when i plot it i found that there is a shifting
> in the
> plot(the north is in the south , and the east is in the west) .i
> have attached both the original plot from plotting the nc file
> itself and the image of plotting the ASCII file .
> i don not know how to tell ncl that the data is from lat1 to lat2
> and lon2 to lon2 specifically.
> Here is the ncl code
> *load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"*
> *load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"*
> *;*************************************************
> *begin*
> *;*************************************************
> *; read in netCDF file*
> *;*************************************************
> * a = asciiread("vdata_ncl",(/10512,1/),"float")*
> *;*************************************************
> *; read in zonal winds*
> *;*************************************************
> *vwnd = new ( (/73,144/), "float") ;; this is fantastic*
> *i=0*
> * do lat=0,72*
> * do lon=0,143*
> * vwnd(lat,lon)=a(i,0)*
> * i=i+1*
> * end do*
> * end do*
> *
> *
> * res = True*
> * res@cnFillOn = True*
> * res@gsnSpreadColors = True*
> * res@tfDoNDCOverlay = True*
> *;*************************************************
> *; create default plot*
> *;*************************************************
> *wks = gsn_open_wks("png","ascii") ; open a ps file*
> *gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap*
> *plot2 = gsn_csm_contour_map_ce(wks,vwnd(:,:),res) ; create a
> default plot*
> *end*
>
> I have also attached the ASCII file data.
> thanks in advance
>
> --
> ===============
> Ahmed Lasheen
> Junior researcher at Cairo Numerical Weather Prediction Center (CNWPC)
> Egyptian Meteorological Authority(EMA)
> Cairo,Egypt
> ===============
>
>
> nc.000001.png
>
>
>
> ascii.000001.png
>
>
>
>
> _______________________________________________
> 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 Sat Feb 26 16:44:46 2011

This archive was generated by hypermail 2.1.8 : Wed Mar 02 2011 - 09:18:13 MST