[ncl-talk] Generating weights using ESMF_regrid_gen_weights

Burakowski, Elizabeth Elizabeth.Burakowski at unh.edu
Tue Nov 26 14:36:19 MST 2019


Hi Dennis,

I converted from short to float, but am still getting all zeros in my regridded file/variable, regardless of whether I use ncremap or ESMF_regrid_with_weights in NCL.

Are there any clues I could look for in my weight file?

Thanks,

Liz

Dr. Elizabeth A Burakowski
She/Her/Hers
Research Assistant Professor
Earth Systems Research Center &
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
8 College Road Durham, NH 03824
603-862-1796
elizabeth.burakowski at unh.edu
________________________________
From: Burakowski, Elizabeth <Elizabeth.Burakowski at unh.edu>
Sent: Tuesday, November 26, 2019 8:02 AM
To: Dennis Shea <shea at ucar.edu>
Cc: ncl-talk at ucar.edu <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Generating weights using ESMF_regrid_gen_weights

Hi Dennis,

[1] I overlooked the short to float, will try that and see if it resolves anything.

[2] I thought the weight files should be compatible? I used ncremap using NCL weight files successfully to get unstructured VR-CESM to rectilinear.

Liz

Dr. Elizabeth A Burakowski
She/Her/Hers
Research Assistant Professor
Earth Systems Research Center &
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
8 College Road Durham, NH 03824
603-862-1796
elizabeth.burakowski at unh.edu
________________________________
From: Dennis Shea <shea at ucar.edu>
Sent: Monday, November 25, 2019 11:25 PM
To: Burakowski, Elizabeth <Elizabeth.Burakowski at unh.edu>
Cc: ncl-talk at ucar.edu <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Generating weights using ESMF_regrid_gen_weights

I have not looked carefully at this.

[1]
The SWE variable is type short.

short SWE(time, lat, lon) ;
SWE:_FillValue = -999s ;
SWE:long_name = "Snow Water Equivalent" ;
SWE:grid_mapping = "crs" ;
SWE:units = "millimeters h20" ;

You *must* unpack before use.

swe = short2flt<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ncl.ucar.edu_Document_Functions_Contributed_short2flt.shtml&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=nDkI23Mf2E7xmTZ_cukgsNqkSQ1gDBIs2dFWWVoChwo&s=NwMtAWSn6DUG3SStTejycr4eTCrruoiJvqxf4eFOXHw&e=>(sfile->SWE)
or, for a focused regional subset
swe = short2flt(sfile->SWE({latS:latN},{lonW:lonE}))

===
[2]
ncremap is a netCDF Operator. It looks like you want the weights generated by NCL's ESMF regrid package.
Are the weight files compatible?

===

D


On Mon, Nov 25, 2019 at 2:35 PM Burakowski, Elizabeth via ncl-talk <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>> wrote:
I'm attempting to generate weights for regridding a 4 km grid to a 14 km grid using ESMF_regrid_gen_weights.

Source grid:
Univ. Arizon Snow Depth and SWE grids
4 km rectilinear, [lat | 621] x [lon |1405]

Destination grid:
VR-CESM CONUS (already regridded using ESMF)
14 km rectilinear, [lat | 361] x [lon |560]

In the below NCL script, I use rectilinear_to_SCRIP on source and destination grids, then ESMF_regrid_gen_weights to create the weight file. No errors occur, however, when I try to regrid using ncremap, I get a bunch of zeros. I'd like to use the weight file on hundreds of files, hence using ncremap.

When I test the weight file on one source variable using NCL's ESMF_regrid_with_weights, I get an argument type mismatch error, but I can't figure out why.  Any ideas how to fix this? Files are on cheyenne.

Script to generate weights:

;======================================================================
; ESMF Regrid:   UA-SNOW-4km (rectilinear) to VRCESM-CONUS (rectilinear)
;======================================================================
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"

;======================================================================
;                         The main code
;======================================================================

begin
;---Specify interpolation to be used
    method = "patch"

;---Specify weight file name
    wgtFileName = "UASnow4km2VRCESMCONUS14km_"+method+".nc"

;---Input file (Source)
    srcFileDir  = "/glade/work/burakows/plot/validation/UA_Snow_4km/"
    srcFileName = "4km_SWE_Depth_WY2014_v01.nc"       ; any UA-Snow file
    srcGridName = "UASnow_4km_SCRIP.nc"

;---Retrieve a sample variable (used in plot)
    sfile       = addfile(srcFileDir+srcFileName,"r")
    srcVarName  = "SWE"                                ; [lat | 621] x [x | 1405]
    var_in      = sfile->$srcVarName$
    printVarSummary(var_in)

    Opt                 = True
    Opt at ForceOverwrite  = True
    Opt at Title           = "UA Snow 4km Grid"

;--- Convert UA Snow 4 km grid to SCRIP convention file
    rectilinear_to_SCRIP(srcGridName,var_in&lat,var_in&lon,Opt)
    delete(Opt)

;================================================================

;---File that contains the destination file coordinates
    dstFileDir  = "/glade/scratch/burakows/archive/VR-CESM_FHISTSTUB.1984-2015.CONUS30x4_prod/lnd/remap/"
    dstFileName = "VR-CESM_FHISTSTUB.1984-2015.CONUS30x4_prod.clm2.h0.2014-01-01-00000_regrid.nc<https://urldefense.proofpoint.com/v2/url?u=http-3A__VR-2DCESM-5FFHISTSTUB.1984-2D2015.CONUS30x4-5Fprod.clm2.h0.2014-2D01-2D01-2D00000-5Fregrid.nc&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=nDkI23Mf2E7xmTZ_cukgsNqkSQ1gDBIs2dFWWVoChwo&s=9S8vxSlf_i2YzThseQwePEY4m0J2XrINsK9l6u4Pwzw&e=>"  ; any VR-CESM file
    dstGridName = "VRCESMCONUS_14km_SCRIP.nc"

;---open VR-CESM file that contains the VR-CESM grid coordinates
    dfile       = addfile(dstFileDir+dstFileName,"r")
    dstVarName  = "H2OSNO"
    dvar_in     = dfile->$dstVarName$           ; [lat | 361 ] x [lon | 560]
    printVarSummary(dvar_in)

    Opt                 = True
    Opt at ForceOverwrite  = True
    Opt at Title           = "VR-CESM CONUS (14 km) grid"

;--- Convert VR-CESM CONUS 14 km to SCRIP convention file
    rectilinear_to_SCRIP(dstGridName,dvar_in&lat,dvar_in&lon,Opt)
    delete(Opt)

;--- Generate the weights to convert UA Snow 4 km grid to VR-CESM CONUS 14 km grid

    Opt         = True
    Opt at InterpMethod    = "patch"
    Opt at ForceOverwrite  = "True"

    ESMF_regrid_gen_weights(srcGridName,dstGridName,wgtFileName,Opt)
    delete(Opt)
end

;===============================================================


Dr. Elizabeth A Burakowski
She/Her/Hers
Research Assistant Professor
Earth Systems Research Center &
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
8 College Road Durham, NH 03824
603-862-1796
elizabeth.burakowski at unh.edu<mailto:elizabeth.burakowski at unh.edu>
_______________________________________________
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<https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=nDkI23Mf2E7xmTZ_cukgsNqkSQ1gDBIs2dFWWVoChwo&s=iaf2-zcxf3E8sZChmMYMznx0UoFQUQmcmNBbSwkBMkM&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191126/42cd6593/attachment.html>


More information about the ncl-talk mailing list