[ncl-talk] Regrid - Longitude

Will Hobbs will.hobbs at utas.edu.au
Mon Jan 17 22:27:34 MST 2022


Let’s 3 you have a 3d array x(time, lat, lon). You need to change the lon values BUT you probably also need to reorder so that lon is monotonic:

lon = where(x&lon.lt.0., x&lon+360, x&lon)  ; change to a 0-360 array
pq = dim_pqsort(lon,2)                                       ;rearrange to a monotonic coord
x = x(:,:,pq)
x&lon = (/ lon /)


Will


From: ncl-talk <ncl-talk-bounces at mailman.ucar.edu> on behalf of "R. Lucas via ncl-talk" <ncl-talk at mailman.ucar.edu>
Reply to: "R. Lucas" <rousslucas at gmail.com>
Date: Tuesday, 18 January 2022 at 4:22 pm
To: "ncl-talk at mailman.ucar.edu" <ncl-talk at mailman.ucar.edu>
Subject: [ncl-talk] Regrid - Longitude

Dear NCL users
I try to flip longitude from -180 - 180 degrees to 0 - 360


function lonFlip (

               x  : numeric

        )
doesnt work.
gsnaddcyclic doesnt work.
neither "longitude = longitude + 360"

what can I try?
Many thanks.


Variable: waveheight
Type: short
Total Size: 1684122 bytes
            842061 values
Number of Dimensions: 2
Dimensions and sizes: [latitude | 1501] x [longitude | 561]
Coordinates:
            latitude: [43.3..45.8]
            longitude: [-1.9..-0.5]
Number Of Attributes: 9
  time : 11704.33333333333
  long_name : significant height of wind and swell waves
  standard_name : sea_surface_wave_significant_height
  units : m
  _FillValue : -32767
  scale_factor : 0.002
  add_offset : 0
  valid_min : 0
  valid_max : 32000


This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220118/296b8d8c/attachment.html>


More information about the ncl-talk mailing list