[ncl-talk] Contour plot with rotated grid shifted to the west
Guido Cioni
guidocioni at gmail.com
Tue Dec 1 01:52:00 MST 2015
Hey David,
yes, the image that I attached in the first email was supposed to represents the final result. I know the “real” coordinate bounds just because I wrote a binary file directly from the postprocessing of the model with the real 2-D lat-lon coordinates in the native grid. Then, I printed the minimum and maximum of those data. Funny thing is that I wasn’t able to use these coordinates for my plot since they were somewhat randomly organized, still don’t know why (probably some fortran way of writing data…). However, the numbers that I attached in the first plot were not correct. These are the correct ones:
lon_min -78.64264
lon_max 25.00719
lat_min 27.55382
lat_max 67.51249
It puzzles me that they are not the same that you chose by replicating the plot “by eye”. And also, you changed the center of the map: I thought that the rotated pole coordinates that I had in the file were the only correct data :)
Using the script that Karin wrote, I should be able to create lat2d-lon2d array and unrotate the data, so that there is no need to play around with the map projection, right?
Guido Cioni
http://guidocioni.altervista.org <http://guidocioni.altervista.org/>
> Il giorno 30 nov 2015, alle ore 23:54, David Brown <dbrown at ucar.edu> ha scritto:
>
> Hi Guido,
> Here's my take on this so far. You enclosed an image labelled "Bolam
> Model". Is that plot supposed to represent the actual grid of your
> data? I am asking because it does not seem possible to reconcile the
> coordinate information that you have provided with this plot. I am
> attaching a couple of plots and a modified version of your script (it
> just draws the map, since we do not have the data). I can
> approximately duplicate the map projection of the Bolam plot by eye,
> but I have to use different numbers than those you have supplied. The
> script first draws a map based on the rotated lat/lon extent that you
> supplied, after conversion into "real" lat/lon values. Then it draws
> an approximation of the Bolam map.
>
> Mary supplied you with the NCL script from Karin that converts from
> rotated coordinates to regular lat/lon. I used a C code that does the
> same thing. You could use either method to create your own 2d lat/lon
> coordinates for this grid. If you would like the C code let me know.
>
> I am curious how you obtained the "real" corner values you used:
>
> Res1 at tfDoNDCOverlay=True
> Res1 at mpLimitMode = "Corners"
> Res1 at mpLeftCornerLatF = 30.35458
> Res1 at mpLeftCornerLonF = -75.14440
> Res1 at mpRightCornerLatF = 65.1125
> Res1 at mpRightCornerLonF = 13.87071
>
> These do not seem to me to be correct either.
>
> It would help if you listed the complete set of rotated lat/lon
> values. You could do it using ncl_filedump:
>
> ncl_filedump -v rlat,rlon complete.nc
>
> -dave
>
>
>
>
>
>
> On Mon, Nov 30, 2015 at 2:18 PM, Mary Haley <haley at ucar.edu <mailto:haley at ucar.edu>> wrote:
>> Correct, NCL can't automatically "unrotate" the coordinates for you based on
>> the rotated coordinates.
>>
>> Karin Meier-Fleischer of DKRZ wrote a couple of functions that "unrotate"
>> the coordinates for you, and I've taken this example and her data file to
>> show how this might work for your data.
>>
>> See the attached script. The data file can be downloaded from:
>>
>> wget ftp.ucar.edu:/pub/scd/haley/tas_mon_1961-1990_rectilinear_grid_2D.nc
>>
>> The rotated grid actually doesn't look that "rotated", because the center
>> lat/lon actually ends up being 0.0. But, hopefully you can use the
>> "unrot_lat" and "unrot_lon" functions to generate your own 2D lat/lon
>> arrays.
>>
>> --Mary
>>
>>
>> On Mon, Nov 30, 2015 at 1:31 PM, Guido Cioni <guidocioni at gmail.com> wrote:
>>>
>>> I don't have the original 2D lat/lon values, that's the problem. However,
>>> your script won't take into consideration the fact that coordinates are
>>> rotated, right? My rlon spans from approximately 340 to 392 degrees, while
>>> rlat from - 10 to +22.. Of course these are not the real coordinates to be
>>> used for plotting the map, since they are expressed in the rotated
>>> framework. Do you see what I mean?
>>> I would like to provide you with the data file but is fairly big (gigs)
>>>
>>> Guido,
>>>
>>> I looked at your script further, and I think the issue is with the map
>>> corners you've selected. You are using the 1D rotated coordinate arrays to
>>> choose the corners, but this is likely not correct. What you really need are
>>> the original 2D lat/lon values, as the two examples illustrated, but I don't
>>> see that you have this information on the file.
>>>
>>> Did you try plotting the data using the coordinate arrays? I've created a
>>> script for you to try, although it's untested because I don't have your data
>>> file.
>>>
>>> Thanks,
>>>
>>> --Mary
>>>
>>>
>>> On Mon, Nov 30, 2015 at 11:45 AM, Guido Cioni <guidocioni at gmail.com>
>>> wrote:
>>>>
>>>> Sure, here it is. I think that the problem is that ncl is expecting 2-D
>>>> latitudes and longitudes while I have 1-D rlon and rlat..
>>>>
>>>> Yes I tried commenting the centers.
>>>>
>>>> m300382 at mlogin103% ncl_filedump complete.nc
>>>> Copyright (C) 1995-2015 - All Rights Reserved
>>>> University Corporation for Atmospheric Research
>>>> NCAR Command Language Version 6.3.0
>>>> The use of this software is governed by a License Agreement.
>>>> See http://www.ncl.ucar.edu/ for more details.
>>>>
>>>> Variable: f
>>>> Type: file
>>>> filename: complete
>>>> path: complete.nc
>>>> file global attributes:
>>>> CDI : Climate Data Interface version 1.4.7
>>>> (http://code.zmaw.de/projects/cdi)
>>>> Conventions : CF-1.0
>>>> history : Fri Nov 27 13:33:35 2015: cdo -f nc copy
>>>> 2014011700_000.grib2 2014011700_001.grib2 2014011700_002.grib2
>>>> 2014011700_003.grib2 2014011700_004.grib2 2014011700_005.grib2
>>>> 2014011700_006.grib2 2014011700_007.grib2 2014011700_008.grib2
>>>> 2014011700_009.grib2 2014011700_010.grib2 2014011700_011.grib2
>>>> 2014011700_012.grib2 2014011700_013.grib2 2014011700_014.grib2
>>>> 2014011700_015.grib2 2014011700_016.grib2 2014011700_017.grib2
>>>> 2014011700_018.grib2 2014011700_019.grib2 2014011700_020.grib2
>>>> 2014011700_021.grib2 2014011700_022.grib2 2014011700_023.grib2
>>>> 2014011700_024.grib2 2014011700_025.grib2 2014011700_026.grib2
>>>> 2014011700_027.grib2 2014011700_028.grib2 2014011700_029.grib2
>>>> 2014011700_030.grib2 2014011700_031.grib2 2014011700_032.grib2
>>>> 2014011700_033.grib2 2014011700_034.grib2 2014011700_035.grib2
>>>> 2014011700_036.grib2 2014011700_037.grib2 2014011700_038.grib2
>>>> 2014011700_039.grib2 2014011700_040.grib2 2014011700_041.grib2
>>>> 2014011700_042.grib2 2014011700_043.grib2 2014011700_044.grib2
>>>> 2014011700_045.grib2 2014011700_046.grib2 2014011700_047.grib2
>>>> CDO : Climate Data Operators version 1.4.7
>>>> (http://code.zmaw.de/projects/cdo)
>>>> dimensions:
>>>> ncl_scalar = 1
>>>> rlon = 706
>>>> rlat = 434
>>>> lev = 20
>>>> time = 73 // unlimited
>>>> variables:
>>>> double rlon ( rlon )
>>>> long_name : longitude in rotated pole grid
>>>> units : degrees
>>>> standard_name : grid_longitude
>>>> axis : X
>>>>
>>>> double rlat ( rlat )
>>>> long_name : latitude in rotated pole grid
>>>> units : degrees
>>>> standard_name : grid_latitude
>>>> axis : Y
>>>>
>>>> character rotated_pole ( ncl_scalar )
>>>> grid_mapping_name : rotated_latitude_longitude
>>>> grid_north_pole_latitude : 44.999996
>>>> grid_north_pole_longitude : 144
>>>>
>>>> double lev ( lev )
>>>> long_name : pressure
>>>> units : Pa
>>>> axis : Z
>>>>
>>>> double time ( time )
>>>> units : hours since 2014-01-17 00:00:00
>>>> calendar : proleptic_gregorian
>>>>
>>>> float gh ( time, lev, rlat, rlon )
>>>> long_name : Geopotential Height
>>>> units : gpm
>>>> code : 5
>>>> grid_mapping : rotated_pole
>>>>
>>>> float t ( time, lev, rlat, rlon )
>>>> long_name : Temperature
>>>> units : K
>>>> grid_mapping : rotated_pole
>>>>
>>>> float u ( time, lev, rlat, rlon )
>>>> long_name : U velocity
>>>> units : m s**-1
>>>> code : 2
>>>> grid_mapping : rotated_pole
>>>>
>>>> float v ( time, lev, rlat, rlon )
>>>> long_name : V velocity
>>>> units : m s**-1
>>>> code : 3
>>>> grid_mapping : rotated_pole
>>>>
>>>> float w ( time, lev, rlat, rlon )
>>>> long_name : Vertical velocity
>>>> units : Pa s**-1
>>>> code : 8
>>>> grid_mapping : rotated_pole
>>>>
>>>> float pv ( time, lev, rlat, rlon )
>>>> long_name : Potential vorticity
>>>> units : K m**2 kg**-1 s**-1
>>>> code : 14
>>>> grid_mapping : rotated_pole
>>>>
>>>> float mterh ( time, rlat, rlon )
>>>> long_name : Model terrain height
>>>> units : m
>>>> code : 7
>>>> grid_mapping : rotated_pole
>>>>
>>>> Il 30 nov 2015 6:28 PM, "Mary Haley" <haley at ucar.edu> ha scritto:
>>>>>
>>>>> Guido,
>>>>>
>>>>> I'm hoping Dave will weigh in here, but it would help if we could at
>>>>> least see the output from:
>>>>>
>>>>> ncl_filedump pv.nc
>>>>>
>>>>> Sometimes the global attributes of the file will give some valuable
>>>>> information about the correct map projection parameters.
>>>>>
>>>>> Did you actually try commenting out the mpCenterLatF and mpCenterLonF
>>>>> settings? In the script you included, these two resources are still being
>>>>> set.
>>>>>
>>>>> It's possible that the data has already been rotated for you.
>>>>>
>>>>> --Mary
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Nov 30, 2015 at 1:33 AM, Guido Cioni <guidocioni at gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Hi all,
>>>>>> I’m trying to produce a contour plot with data on a rotated grid. The
>>>>>> original data look like that
>>>>>>
>>>>>>
>>>>>> Since I have the rotated north pole latitude (44.999996) and longitude
>>>>>> (144.0) in my data file I used the second example of the support page on
>>>>>> rotated grid.
>>>>>>
>>>>>> Res1 at tfDoNDCOverlay=True
>>>>>> Res1 at mpLimitMode = "Corners"
>>>>>> Res1 at mpLeftCornerLatF = lat(0)
>>>>>> Res1 at mpLeftCornerLonF = lon(0)
>>>>>> Res1 at mpRightCornerLatF = lat(nlat-1)
>>>>>> Res1 at mpRightCornerLonF = lon(nlon-1)
>>>>>> Res1 at mpCenterLatF = 90 - north_pole_lat
>>>>>> Res1 at mpCenterLonF = 180 + north_pole_lon
>>>>>>
>>>>>> However I get this result ( I believe this is Australia):
>>>>>>
>>>>>>
>>>>>> After several attempts I was able to plot the data using as bounds the
>>>>>> “real” coordinates of the rotated projection, without specifying the center,
>>>>>> e.g. :
>>>>>>
>>>>>> Res1 at tfDoNDCOverlay=True
>>>>>> Res1 at mpLimitMode = "Corners"
>>>>>> Res1 at mpLeftCornerLatF = 30.35458
>>>>>> Res1 at mpLeftCornerLonF = -75.14440
>>>>>> Res1 at mpRightCornerLatF = 65.1125
>>>>>> Res1 at mpRightCornerLonF = 13.87071
>>>>>>
>>>>>> But the contour plot is still slightly shifted to the west as you can
>>>>>> see in this image:
>>>>>>
>>>>>>
>>>>>> I know that in the data file my coordinates span from
>>>>>> rlon={340,392.875} and rlat={-9.962499,22.512501}.
>>>>>>
>>>>>> What am I missing?
>>>>>> Is there any additional documentation on rotated grid?
>>>>>>
>>>>>> Attached is my NCL script (data are too big).
>>>>>>
>>>>>>
>>>>>>
>>>>>> Guido Cioni
>>>>>> http://guidocioni.altervista.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk at ucar.edu
>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>
>>>>>
>>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
> <pv_test.000001.png><pv_test.000002.png><plot_pv-mod.ncl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151201/120e54a3/attachment.html
More information about the ncl-talk
mailing list