[ncl-talk] Interpolating CCSM grid to RAP/HRRR grid

Wilson, Malcolm Tyree mtw5270 at psu.edu
Wed May 12 12:58:06 MDT 2021


Hi Adam,

You were right! The longitudes of the HRRR grid were out of range with the CCSM grid because the HRRR uses 180-degree coordinate values [-180:180] while CCSM uses 360-degree coordinate values [0:360]. After I adjusted the longitudes, the data was successfully interpolated with all the proper values. Thank you so much for the help everyone!

-Malcolm W.
________________________________
From: Adam Phillips <asphilli at ucar.edu>
Sent: Wednesday, May 12, 2021 1:55 PM
To: Wilson, Malcolm Tyree <mtw5270 at psu.edu>
Cc: 아나유즈바시츠 <ajuzbasic at pusan.ac.kr>; ncl-talk at ucar.edu <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Interpolating CCSM grid to RAP/HRRR grid

Hi Malcolm,
One thing to check, is to make sure the input latitudes and longitudes are in the same direction and within the same range as the regridded latitudes and longitudes. Your input coordinates are:
lat: [20.26178..53.24607]
lon: [225..300]

Do your target grid longitudes fall within 225-300E? And do the latitudes fall within 20-53N?
What is the output from :
printMinMax(lat2d,0)
printMinMax(lon2d,0)

Adam



On Wed, May 12, 2021 at 10:18 AM Wilson, Malcolm Tyree via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>> wrote:
Hi again,

rgird2rcm ran fine without any errors, thank you! However, I'm still getting back nothing but filled values (every point is a fill value) in the returned, interpolated array. I even adjusted the data type of fi to double to see if that was causing issues, but the same issue appears. Below is the code that I'm using now, along with the data summary of both fi and the output (fi after interpolation) arrays. I'm wondering if this is supposed to happen, or is there something I'm missing? Thanks!

;Interpolation

  f = addfile ("~/small_hus_may_pert_2010-2050.nc<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsmall_hus_may_pert_2010-2050.nc%2F&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487431417%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2BrNUpXrfKvT4Dx2lgU1YTHik2ZZwZeUw1aRyVGl7fCo%3D&reserved=0>","r")
  g = addfile ("~/hrrr.t00z.wrfprsf00.nc<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhrrr.t00z.wrfprsf00.nc%2F&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487441407%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2BmjdqdAsduswusxehzYW%2B3o%2B%2Bt9KufsReEP5I75IqmE%3D&reserved=0>","r")

  lat = f->lat
  lon = f->lon

  lat2d = g->gridlat_0              ; (N,M)
  lon2d = g->gridlon_0

  ;LATD = todouble(lat2d)       ; (N*M)
  ;LOND = (lon2d)

  fi = f->hus_pert

  hrrr_grid_data = rgrid2rcm_Wrap(lat,lon,fi,lat2d,lon2d, 0)

  printVarSummary(hrrr_grid_data)

Variable: fi
Type: float
Total Size: 228384 bytes
            57096 values
Number of Dimensions: 4
Dimensions and sizes:   [time | 1] x [lev | 26] x [lat | 36] x [lon | 61]
Coordinates:
            time: [ 0.. 0]
            lev: [0.9925562..0.00354464]
            lat: [20.26178..53.24607]
            lon: [225..300]
Number Of Attributes: 1
  units :       kg/kg

Variable: hrrr_grid_data
Type: float
Total Size: 198134664 bytes
            49533666 values
Number of Dimensions: 4
Dimensions and sizes:   [time | 1] x [lev | 26] x [ygrid_0 | 1059] x [xgrid_0 | 1799]
Coordinates:
            time: [ 0.. 0]
            lev: [0.9925562..0.00354464]
Number Of Attributes: 3
  _FillValue :  9.96921e+36
  units :       kg/kg
  ncl : rgrid2rcm used for interpolation
________________________________
From: 아나유즈바시츠 <ajuzbasic at pusan.ac.kr<mailto:ajuzbasic at pusan.ac.kr>>
Sent: Wednesday, May 12, 2021 8:06 AM
To: Wilson, Malcolm Tyree <mtw5270 at psu.edu<mailto:mtw5270 at psu.edu>>
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu> <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Subject: Re: [ncl-talk] Interpolating CCSM grid to RAP/HRRR grid

Hi Malcom,

Apologies, I mixed it up. The function you need is rgrid2rcm, which is, as you said, opposite of rcm2rgrid. This one:  http://www.ncl.ucar.edu/Document/Functions/Built-in/rgrid2rcm.shtml<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ncl.ucar.edu%2FDocument%2FFunctions%2FBuilt-in%2Frgrid2rcm.shtml&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487451405%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2F3fGZGNFPPMZ09uYMYy50QSGw5QReiU4T%2Ff02z4En98%3D&reserved=0>. This should do what you want, without giving you all the missing values.



On Wed, May 12, 2021 at 9:00 PM Wilson, Malcolm Tyree <mtw5270 at psu.edu<mailto:mtw5270 at psu.edu>> wrote:
Hi,

So, I'm trying to re-grid from a rectilinear grid (CCSM) to a curvilinear grid (HRRR). The CCSM had one-dimensional coordinates arrays while the HRRR has 2-dimensional coordinate arrays. So, the opposite of what rcm2rgrid is doing, which is why I tried using linint2_points_Wrap instead. Thanks!

-Malcolm W.
________________________________
From: 아나유즈바시츠 <ajuzbasic at pusan.ac.kr<mailto:ajuzbasic at pusan.ac.kr>>
Sent: Tuesday, May 11, 2021 10:42 PM
To: Wilson, Malcolm Tyree <mtw5270 at psu.edu<mailto:mtw5270 at psu.edu>>
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu> <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Subject: Re: [ncl-talk] Interpolating CCSM grid to RAP/HRRR grid

Hi Malcom,

It seems to me that you are trying to regrid from curvilinear grid (with 2D lat and lon) to rectilinear grid. You should rcm2rgrid function for that, not linint, as the linint one is meant to interpolate from one rectilinear grid to another.
 Try to use this https://www.ncl.ucar.edu/Document/Functions/Contributed/rcm2rgrid_Wrap.shtml<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ncl.ucar.edu%2FDocument%2FFunctions%2FContributed%2Frcm2rgrid_Wrap.shtml&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487451405%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wuMk3JGHugteSb3dbNBAFFS3kXncQVHcLBtmfEIcq9k%3D&reserved=0>

On Wed, May 12, 2021 at 10:51 AM Wilson, Malcolm Tyree via ncl-talk <ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>> wrote:
Hello Everyone,

I've been trying to interpolate humidity and temperature data from CCSM to the RAP/HRRR grid using NCL (specifically using the function linint2_points and linint2_points_Wrap). I created a script that should interpolate the data from CCSM to the HRRR grid, but the script returned an array that contains nothing but filled values (9.96921e+36) and no data of the variable field I'm interpolating. I don't understand this happened, and I used both the linint2_points and linint2_points_Wrap functions. Is this supposed to happen, or and I'm missing something? Below is the code I used. Any advice would be appreciated. Thanks!

-Malcolm W.

  f = addfile ("~/small_hus_may_pert_2010-2050.nc<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsmall_hus_may_pert_2010-2050.nc%2F&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487461403%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=a1KobiM9pcZrKCx3dIOGojK5X0%2FihNyxLwA6k1weycY%3D&reserved=0>","r")
  g = addfile ("~/hrrr.t00z.wrfprsf00.nc<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fhrrr.t00z.wrfprsf00.nc%2F&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487461403%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YJvWaJBAip1DvR6LJJMDR3GGrSin44RB%2Fg5RTkWOauo%3D&reserved=0>","r")

  lat = f->lat      ;(length=36)
  lon = f->lon    ;(length=61)

  lat2d = g->gridlat_0              ; (shape: (1059,1799))
  lon2d = g->gridlon_0            ; (shape: (1059,1799))

  LAT1D = ndtooned(lat2d)
  LON1D = ndtooned(lon2d)

  fi = f->hus_pert ;(humidity data I'm interpolating)

  fo = linint2_points_Wrap(lon,lat,fi, False, LON1D,LAT1D, 0)

  hrrr_data = onedtond( ndtooned(fo), (/1,26,1059,1799/) ) ;(conatins nothing but filled values)

_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.ucar.edu%2Fmailman%2Flistinfo%2Fncl-talk&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487471393%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4LHsFe4Lj%2FI%2Bjz%2BRKe24v%2B845WsBiSynFoUR%2BZmHd4s%3D&reserved=0>
_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.ucar.edu%2Fmailman%2Flistinfo%2Fncl-talk&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487471393%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4LHsFe4Lj%2FI%2Bjz%2BRKe24v%2B845WsBiSynFoUR%2BZmHd4s%3D&reserved=0>


--
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cgd.ucar.edu%2Fstaff%2Fasphilli%2F&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487481386%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=drHF72ITbhHXDsR6ZH7ylLa6HoKWih4KLe%2FMNowf%2Fws%3D&reserved=0>   303-497-1726

<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cgd.ucar.edu%2Fstaff%2Fasphilli&data=04%7C01%7Cmtw5270%40psu.edu%7Cb5220e857808497e675a08d9156f2ac0%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C1%7C637564389487481386%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=e%2BpUNRSrudoxOAFnfqm3GZhlpQZPhOyXbhD1mrZJwbU%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210512/09f676e5/attachment.html>


More information about the ncl-talk mailing list