[1] If you are new to NCL, please read the Mini-Language Manual at:
http://www.ncl.ucar.edu/Document/Manuals/
Understand 'coordinate subscripting' and 'named dimensions'.
These are netCDF terminology.
[2] NCL has numerous regridding functions:
http://www.ncl.ucar.edu/Document/Functions/regrid.shtml
[3] Assuming by "wind data maps", you mean that you are regridding
the zonal and meridional wind components (U,V). Technically,
U and V should be interpolated *together* to accommodate moving
to a new location on the sphere. NCL has spherical harmonic
based regridding which can be used for this task. Specifically,
the gaussian grid (T382) to fixed (regular; 0.5x0.5) function:
http://www.ncl.ucar.edu/Document/Functions/Contributed/g2fshv_Wrap.shtml
See: http://www.ncl.ucar.edu/Applications/regrid.shtml
Example 3
The CFSR global is a T382 gaussian grid (576x1152; 38km;
0.313 at Eq). **Depending on the application of the
interpolated data**, you could likely independently
interpolate U and V via bilinear interpolation:
http://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_Wrap.shtml
[4] PLease note: **The most important rule of data processing
is to look at and understand your data.** Use 'ncl_filedump'
to examine the contents of the CFSR grib2 files *prior*
to doing anything.
http://www.ncl.ucar.edu/Document/Tools/ncl_filedump.shtml
[5] Your 720x361 target grid would be 361x720 in NCL.
Column-major vs Row-major ordering.
===
[6] Finally, use NCL's coordinate subscripting to "trim"
the interpolated grid.
===
Your question was vague: Are the 'wind map' variable 3D of 4D?
A sketch ..
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
in = addfile("CFSR.grb2","r")
U = in->U.... ; U(:,:,:,:) or U(:,:,:)
V = in->V....
printVarSummary(U) ; variable overview
; NCL wants variables ordered South-to-Noth
U = U(:,:,::-1,:)
V = V(:,:,::-1,:)
printVarSummary(U) ; variable overview *after* reorder
dimU = dimsizes(U)
print(dimU)
rankU = dimsizes(dimU)
; target 0.5x0.5 grid size
nlat = 361
mlon = 720
; spherical harmonic
uNew = new ( (/...,...,nlat,mlon/), typeof(U) )
vNew = new ( (/...,...,nlat,mlon/), typeof(v) )
g2fshv_Wrap (U,V,Unew,Vnew)
printVarSummary(Unew)
or
; linint2
lat = latGlobeF(nlat, "lat", "latitude", "degrees_north")
lon = lonGlobeF(mlon, "lon", "longitude", "degrees_east")
Unew = linint2_Wrap(U&..., U&..., U, True, lon, lat, 0)
V V V V
printVarSummary(Unew)
; trim via coordinate subscripting
latS = ...
latN = ...
lonL = ...
lonR = ...
Utrim = Unew(...,{LatS:latN},{lonL,lonR})
Vtrim = Vnew(...,{LatS:latN},{lonL,lonR})
; write to netCDF (NCL does *not* output GRIB)
system("/bin/rm -f sample.nc") ; remove any pre-existing file
ncdf = addfile("sample.nc" ,"c") ; open output netCDF file
; make time an UNLIMITED dimension
;;filedimdef(ncdf,"time",-1,True)
; output variables directly
ncdf->U = Utrmm
ncdf->V = Vtrmm
Good luck
On 5/20/14, 7:21 PM, Mary Haley wrote:
> George,
>
> Do you have a sample CFSR dataset you can point us to? I need to know what
> kind of grid it’s on before I can answer this question. By this I mean is your
> data on a rectilinear grid, a curvilinear grid, or an unstructured grid?
>
> Also, how big is the original lat/lon grid?
>
> Meanwhile, please check out our ESMF regridding page, which has our most
> robust regridding capabilities.
>
> http://www.ncl.ucar.edu/Applications/ESMF.shtml
>
> The ESMF_regrid_x.ncl scripts on this page are probably the ones you want to
> look at, as they are a bit more simple than the ESMF_all_x.ncl scripts.
>
> Most of these examples show how to regrid from some grid to a specific degree
> of grid, like 0.25 degree, or 1 degree. You can look at examples 4, 7, 10, and 15
> to start with:
>
> http://www.ncl.ucar.edu/Applications/ESMF.shtml#ex4
> http://www.ncl.ucar.edu/Applications/ESMF.shtml#ex7
> http://www.ncl.ucar.edu/Applications/ESMF.shtml#ex10
> http://www.ncl.ucar.edu/Applications/ESMF.shtml#ex15
>
> Finally, we have some ESMF regridding templates at:
>
> http://www.ncl.ucar.edu/Applications/Templates/#ESMFRegriddingTemplates
>
> If you know your data is curvlinear (represented by 2D lat and 2D lon arrays), then
> you might want to look at the ESMF_curv_to_1deg.ncl script (it’s easy to change the
> “1deg” to “0.5deg”).
>
> Or, if your data is rectilinear, then look at “ESMF_rect_to_5deg.ncl”.
>
> —Mary
>
> On May 20, 2014, at 7:48 AM, George Lavidas <g.lavidas@ed.ac.uk> wrote:
>
>> Hello
>>
>> I am quite new to the ncl toolbox and I would like to ask a thing
>> concerning the regridding options.
>>
>> I am using CFSR wind data maps that are taken for global scale and would
>> like to re-size them into a smaller grid so I can obtain the netCDF
>> information only for a specified area and use them for wave simulations.
>>
>> I previously tried with the CDO toolbox as well to re-build the map to
>> my own preferences but that resulted to a "zeroing" of the coordinates
>> of the wind files not giving me the correct wind fields to simulate
>> As you can see in the attached picture the actual result i got was far
>> from the area that wanted the wind components to affect and was limited
>> only to a small rectangular area on the upper left corner.
>>
>> I think I can use some of the scripts from the on the ncl page
>> (https://www.ncl.ucar.edu/Applications/concepts_list.shtml)
>>
>> But I am confused on the process
>>
>> My task is to remap the grid into a regular one with resolution 720x361
>> (or 0.5x0.5 degrees or less) then "trim" the area I want into my desired
>> shape and by using a python script I have written extract the wind
>> components so i can insert them to my simulation.
>>
>> Any advice would be helpful, since I am new to large data manipulation
>> and extraction.
>>
>> Thank you very much for your help in advance
>> George
>>
>> --
>> George Lavidas
>>
>>
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336.
>>
>> <mesh.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
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 21 07:36:27 2014
This archive was generated by hypermail 2.1.8 : Tue May 27 2014 - 15:45:08 MDT