Re: rotated coordinates

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 03 2012 - 17:17:26 MDT

Hi Alex,

Are the lat/lon variables in the NetCDF files actually 2D? You don't show what they look like.
There are 2 ways to do this.
1) plot the data in a native projection. That would require knowing the center latitude and longitude of the projection plus 2 of the corner points, (LL - UR) or (UL - LR). Presumably this information could be deduced from your 'dat' file. The center lat/lon would be the geographic coordinates that correspond with the 0,0 point in the rotated system. The lower left and upper right would be the geographic coordinates corresponding to the minimum rotated values along both axes, and the UR is the maximum values along both rotated axes.
Set the projection to CylindricalEquidistant with center lat and lon set as above. Set mpLimitMode to Corners and set the Left and Right Corner resources. Set tfDoNDCOverlay to True and you should be good to go.

2) plot the data using an arbitrary projection. Read the geographic coordinates from your dat file, and create 2D lat and lon variables from them. You will need to make sure that they correspond properly with the (presumably) 1D rotated coordinates. For example, if (0,0) in the rotated system has array indexes 50 for lat and 55 for lon, then element (50,55) of the geographic arrays should give you the geographic lat and lon that correspond to rotated coordinates (0,0) in the dat file.
Set sfXArray and sfYArray to the 2d geographic lon and lat coordinates you have just created. Set tfDoNDCOverlay to False (the default), and plot. In this case you don't need to be precise with the map limits -- you can experiment once you have zoomed in to the general area.

Hope this helps. You might want to check out the example http://www.ncl.ucar.edu/Applications/rotatedltln.shtml. It is not exactly your situation but it might be helpful.
 -dave

On Oct 3, 2012, at 4:40 PM, Alexander Semenov wrote:

> Hi
>
> I have a question about processing rotated coordinates data in NCL. I don't know how to do that, Do you have any suggestions?
>
> I have a modeling output files each of them containing the following:
>
> netcdf atm.1961-08.daily {
> dimensions:
> lon = 110 ;
> lat = 100 ;
> record = UNLIMITED ; // (31 currently)
> variables:
> float mslp(record, lat, lon) ;
> mslp:WMO = 1 ;
> mslp:LTYP = 103 ;
> mslp:ALEV = 0.f ;
> float u10(record, lat, lon) ;
> u10:WMO = 33 ;
> u10:LTYP = 105 ;
> u10:ALEV = 10.f ;
> float v10(record, lat, lon) ;
> v10:WMO = 34 ;
> v10:LTYP = 105 ;
> v10:ALEV = 10.f ;
>
> In addition to it, I have a dat file which contains in the 3rd column the geographical latitude, in 4th column it is the geogr. longitude (the 1st and 2nd columns contain the rotated coord.)
>
> I'm trying to plot wind speed by running the following script:
>
> begin
>
> wks = gsn_open_wks("x11","wind")
>
> path="/import/archive/u1/uaf/asemenov/all_files/HIRHAM/"
>
> files = systemfunc("ls "+path+"atm.*")
>
> do j = 0, dimsizes(files)-1
> fname = files(j)
>
> f = addfile (fname, "r")
>
> gsn_define_colormap(wks,"WhiteGreen")
>
> res = True
>
> u = f->u10
> v = f->v10
> lat2d = f->lat ; read in 2D lat/lon
> lon2d = f->lon
> var = u
> var = -999.
> var = (u^2+v^2)^0.5
> var@long_name = "wind speed at 10m"
> plot = gsn_csm_contour_map(wks,var(j,:,:),res)
> draw(plot)
> frame(wks)
>
>
> end do
>
> end
>
>
> --
> regards
>
> *******************************************************
> Alex Semenov
>
> PhD Student - Research Assistant
> International Arctic Research Center
> Department of atmospheric sciences
> University of Alaska Fairbanks
>
> 930 Koyukuk dr, 408c3
> Fairbanks, AK, USA, 99775
> work phone +19074742672
>
> _______________________________________________
> 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 Wed Oct 3 17:17:36 2012

This archive was generated by hypermail 2.1.8 : Mon Oct 08 2012 - 15:54:16 MDT