[ncl-talk] Longitude Flip in ocean data

Arun Kumar Dwivedi dwivedi.arunkumar at gmail.com
Fri Jan 22 02:25:01 MST 2016


Dear All,
In continution to our previous query and according to the suggestions
given, LonPivot function is used and the longitude array was reassigned
from -180 to 180 after LonPivot, but still there is a problem with the
output plot. Attached is our output file and the modified script.
The variable summary before LonPivot and After LonPivot is given below.

*Before assigning*
Variable: var
Type: float
Total Size: 4499840 bytes
            1124960 values
Number of Dimensions: 4
Dimensions and sizes:    [T1 | 20] x [ZT_K1_1 | 1] x [YT_J | 178] x [XT_I |
316]
Coordinates:
            T1: [1005606..1005720]
            ZT_K1_1: [ 2.5.. 2.5]
            YT_J: [ -79..  79]
            XT_I: [   1.. 359]
Number Of Attributes: 4
  missing_value :    -1e+34
  _FillValue :    -1e+34
  long_name :    Sea Surface Temperature
  units :    Deg C


*AFTER LONPIVOT*
Variable: var1
Type: float
Total Size: 4499840 bytes
            1124960 values
Number of Dimensions: 4
Dimensions and sizes:    [T1 | 20] x [ZT_K1_1 | 1] x [YT_J | 178] x [XT_I |
316]
Coordinates:
            T1: [1005606..1005720]
            ZT_K1_1: [ 2.5.. 2.5]
            YT_J: [ -79..  79]
            XT_I: [-179.. 179]
Number Of Attributes: 5
  missing_value :    -1e+34
  _FillValue :    -1e+34
  long_name :    Sea Surface Temperature
  units :    Deg C
  lonPivot :    reordered via lonPivot [NCL]: pivotLon=181

Thanks & Regards
Arun Kumar Dwivedi
Mob :09546189035

On Fri, Jan 22, 2016 at 1:29 AM, Mary Haley <haley at ucar.edu> wrote:

> Arun,
>
> The issue is that "lonFlip" is expecting the "180" point to be exactly
> halfway in your longitude array. We need to update the documentation to
> indicate this.
>
> Your longitude values don't jump to 181 until more than halfway through
> the array, so this is why lonFlip was failing.
>
> You can use lonPivot to do what you want:
>
>  var = in->$ip$
>  var = lonPivot(var,181)
>  printVarSummary(var)
>
> To make sure that you are referencing the correct latitudes and longitudes
> afterwards, you want to set xlat and xlon to the arrays that are attached
> to "var", instead of reading them off the file:
>
> xlat = var&YT_J
> xlon = var&XT_I
>
> These changes should get you the plot you want.
>
> -Mary
>
>
> On Tue, Jan 19, 2016 at 9:28 PM, Arun Kumar Dwivedi <
> dwivedi.arunkumar at gmail.com> wrote:
>
>> Dear All,
>> As discussed earlier, We have uploaded our nc file and our script in the
>> ftp server. Our requirement is to plot a parameter for Atlantic and Indian
>> ocean (For eg -90W to 100E and from -50S to 50 N).. And our resultant
>> output is also attached where in the plot is only until 0E.
>>
>> NOTE: We are taking our inputs from a dat file which is also attached
>> here (mom-ctrl-slc.dat)
>>
>> Data File Name--Forecast201510040000.nc
>> Input control File Name  --mom-ctrl-slc.dat
>> Script Name-- mom-slc.ncl
>> Our output Name-- mom_slc_TEMPNEW_2015100612UTC.png
>>
>> Thanks & Regards
>> Arun Kumar Dwivedi,
>> Project Engineer - II
>> Computational Earth Science Group
>> CDAC, Pune - 411 007
>> Mob :09546189035
>>
>> On Sat, Jan 16, 2016 at 2:13 AM, Mary Haley <haley at ucar.edu> wrote:
>>
>>> Can you provide me with the data file so I can test this here?  It looks
>>> like the longitude values should be flipping correctly, but I don't
>>> understand why you are getting values from -257.75 to 101.75.
>>>
>>> The longitude array must be monotonically increasing for this to work, I
>>> believe, but I want to check the array myself to see what's going on with
>>> it.
>>>
>>> If your file is too large, then if you could just write sst to the file
>>> by itself, and send me that, then I don't need anything else.
>>>
>>> You can write sst to a file using the following code:
>>>
>>>
>>>   system("rm marytest.nc")
>>>   mout = addfile("marytest.nc","c")
>>>   mout->sst = sst
>>>
>>> You can upload the file to our ftp:
>>>
>>> http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP
>>>
>>> or share it via Dropbox or Google Drive or something similar.
>>>
>>> Thanks,
>>>
>>> --Mary
>>>
>>>
>>>
>>> On Wed, Jan 13, 2016 at 12:40 AM, Arun Kumar Dwivedi <
>>> dwivedi.arunkumar at gmail.com> wrote:
>>>
>>>> Dear all,
>>>> Thank q for the response
>>>> In continuation to my above query the description is given below
>>>>
>>>> Our data is rectilinear data ( data is in rectangular matrix with
>>>> un-uniform spacing). '
>>>>
>>>> Our basic data structure is :
>>>>
>>>> Variable: sst
>>>> Type: float
>>>> Total Size: 4499840 bytes
>>>>             1124960 values
>>>> Number of Dimensions: 4
>>>> Dimensions and sizes:    [T1 | 20] x [ZT_K1_1 | 1] x [YT_J | 178] x
>>>> [XT_I | 316]
>>>> Coordinates:
>>>>             T1: [1005606..1005720]
>>>>             ZT_K1_1: [ 2.5.. 2.5]
>>>>             YT_J: [ -79..  79]
>>>>             XT_I: [   1.. 359]
>>>> Number Of Attributes: 4
>>>>   missing_value :    -1e+34
>>>>   _FillValue :    -1e+34
>>>>   long_name :    SST
>>>>   units :    C
>>>>
>>>>
>>>> ****************************
>>>> Our actual problem is we need to plot longitude in the selected range
>>>> for eg -90W to 120E then it doesnt accept the -90W value since the
>>>> longitude array is from 0 to 360 , the plot comes from 0 to 120E only. (-ve
>>>> values not accepted.) . To solve this we used lonflip function so that our
>>>> longitude array changes from -180 to 180. but since it is un-uniform data ,
>>>> ***********************************
>>>> After LonFlip , it is
>>>>
>>>> Variable: sstnew
>>>> Type: float
>>>> Total Size: 4499840 bytes
>>>>             1124960 values
>>>> Number of Dimensions: 4
>>>> Dimensions and sizes:    [T1 | 20] x [ZT_K1_1 | 1] x [YT_J | 178] x
>>>> [XT_I | 316]
>>>> Coordinates:
>>>>             T1: [1005606..1005720]
>>>>             ZT_K1_1: [ 2.5.. 2.5]
>>>>             YT_J: [ -79..  79]
>>>>             XT_I: [-257.75..101.75]
>>>> Number Of Attributes: 5
>>>>   missing_value :    -1e+34
>>>>   _FillValue :    -1e+34
>>>>   long_name :    SST
>>>>   units :    C
>>>>   lonFlip :    longitude coordinate variable has been reordered via
>>>> lonFlip
>>>>
>>>> The longitude is originally from 0 to 360 and after LonFlip it is
>>>> -257.75..101.75... But when we are plotting in the longitude range (-90,
>>>> 120) it is coming only in the longitude range (-90, 101)
>>>>
>>>> So what would be the solution for our problem
>>>>
>>>>
>>>>
>>>> Thanks & Regards
>>>> Arun Kumar Dwivedi,
>>>> Project Engineer - II
>>>> Computational Earth Science Group
>>>> CDAC, Pune - 411 007
>>>> Mob :09546189035
>>>>
>>>> On Tue, Jan 12, 2016 at 7:44 PM, Mary Haley <haley at ucar.edu> wrote:
>>>>
>>>>> Arun,
>>>>>
>>>>> We need a little more information here.  Is your data on a rectilinear
>>>>> grid? This function only works for rectilinear grids (grids represented by
>>>>> 1D lat/lon arrays).
>>>>>
>>>>> Did you look at your longitude values to make sure there are no issues
>>>>> with them before you do lonFlip?
>>>>>
>>>>> It would help if we could see a "printVarSummary" of the variable you
>>>>> are trying to call lonFlip on, and also any error messages.
>>>>>
>>>>> --Mary
>>>>>
>>>>>
>>>>> On Sun, Jan 10, 2016 at 11:10 PM, Arun Kumar Dwivedi <
>>>>> dwivedi.arunkumar at gmail.com> wrote:
>>>>>
>>>>>> Dear All,
>>>>>> I am working on ocean data (MOM and WAM) for global domain. I have
>>>>>> issues with longitude, when trying to plot in for particular region. For eg
>>>>>> if I want plot with Latitude 0 to 30 and Lon -40 to 100. Then it doesn't
>>>>>> recognize the value -40 in the longitude array.
>>>>>>
>>>>>> For this i have tried using LonFlip function, it works fine with
>>>>>> uniform grid but doesn't work with my data set which has varied grid
>>>>>> resolution (0.5,1 and 1.5).
>>>>>>
>>>>>>
>>>>>> Thanks & Regards
>>>>>> Arun Kumar Dwivedi,
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160122/bdb2f5a9/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mom_slc_TEMPNEW_2015100612UTC.png
Type: image/png
Size: 148661 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160122/bdb2f5a9/attachment.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mom-slc.ncl
Type: application/octet-stream
Size: 3543 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160122/bdb2f5a9/attachment.obj 


More information about the ncl-talk mailing list