[ncl-talk] ESMF Regridding of WRF output files - issues on variable coordinates

Dennis Shea shea at ucar.edu
Thu Dec 6 08:15:24 MST 2018


Your email is a confusing.

Reset the following:
opt at CopyVarCoords = True

===
*   XLAT_SOURCE = sfile->XLAT*
*   XLONG_SOURCE  = sfile->XLONG*

; writing to netCDF

 system(...)   ; remove any preexisting file
 fout = addfile(... ,"c")

 fout->T2 = ... regrid variable...

* fout->XLAT = XLAT_SOURCE*
* fout->XLONG = XLONG_SOURCE*


On Wed, Dec 5, 2018 at 10:08 PM Mirce Morales <mirce.morales at gmail.com>
wrote:

> Hello all,
>
> I am trying to regrid some variables in my WRF output files (wrfout_d0*),
> to do it, I am taking as a guide the following script on the NCL web page:
> https://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_20.ncl
>
> Up to now, I was able to run the script without error, but I see that if I
> do ncdump -h "My regridded file", there is like a matrix of numbers where
> the XLAT and XLONG should be, so it is not possible to see the variables
> and their attributes well....to avoid that, I found out I have to set
> opt at CopyVarCoords  = False.
>
> The problem is that when I do that, now I get the following kind of
> attributes in my regridded files:
>
> *netcdf wrfout_d03_2010-09-01_00\:00\:00 {*
> *dimensions:*
> *        ncl0 = 1 ;*
> *        ncl1 = 156 ;*
> *        ncl2 = 138 ;*
> *        ncl3 = 1 ;*
> *        ncl4 = 156 ;*
> *        ncl5 = 138 ;*
> *        ncl6 = 1 ;*
> *        ncl7 = 156 ;*
> *        ncl8 = 138 ;*
> *        ncl9 = 1 ;*
> *        ncl10 = 156 ;*
> *        ncl11 = 138 ;*
> *        ncl12 = 1 ;*
> *        ncl13 = 156 ;*
> *        ncl14 = 138 ;*
> *        ncl15 = 1 ;*
> *        ncl16 = 156 ;*
> *        ncl17 = 138 ;*
> *        ncl18 = 1 ;*
> *        ncl19 = 156 ;*
> *        ncl20 = 138 ;*
> *        ncl21 = 1 ;*
> *        ncl22 = 156 ;*
> *        ncl23 = 138 ;*
> *        ncl24 = 1 ;*
> *        ncl25 = 156 ;*
> *        ncl26 = 138 ;*
> *        ncl27 = 1 ;*
> *        ncl28 = 156 ;*
> *        ncl29 = 138 ;*
> *        ncl30 = 1 ;*
> *        ncl31 = 156 ;*
> *        ncl32 = 138 ;*
> *variables:*
> *        float T2(ncl0, ncl1, ncl2) ;*
> *                T2:missing_value = 9.96921e+36f ;*
> *                T2:remap = "remapped via ESMF_regrid_with_weights:
> Bilinear" ;*
> *                T2:_FillValue = 9.96921e+36f ;*
> *                T2:FieldType = 104 ;*
> *                T2:MemoryOrder = "XY " ;*
> *                T2:description = "TEMP at 2 M" ;*
> *                T2:units = "K" ;*
> *                T2:stagger = "" ;*
>
> When it should be similar to this:
>
> *netcdf wrfout_d03_2010-09-01_01\:00\:00 {*
> *dimensions:*
> * Time = UNLIMITED ; // (1 currently)*
> * DateStrLen = 19 ;*
> * west_east = 54 ;*
> * south_north = 60 ;*
> * bottom_top = 49 ;*
> * bottom_top_stag = 50 ;*
> * soil_layers_stag = 4 ;*
> * west_east_stag = 55 ;*
> * south_north_stag = 61 ;*
> *variables:*
> *float T2(Time, south_north, west_east) ;*
> * T2:FieldType = 104 ;*
> * T2:MemoryOrder = "XY " ;*
> * T2:description = "TEMP at 2 M" ;*
> * T2:units = "K" ;*
> * T2:stagger = "" ;*
> * T2:coordinates = "XLONG XLAT XTIME" ;*
>
> I don't know how to fix this....In case it helps, these are the regridding
> options I am using:
>
> *;---Open one WRF file *
> *   sfile = addfile("../IMTAProy_BMJ/wrfout_d03_2010-10-31_16:00:00","r")
>   ; contains source grid*
>
> *;---Read lat/lon of source grid*
> *    lat_src = sfile->XLAT(0,:,:)*
> *    lon_src = sfile->XLONG(0,:,:)*
>
> *;---Read lat/lon of destination grid*
> *    lat_dst = dstfile->XLAT_M(0,:,:)*
> *    lon_dst = dstfile->XLONG_M(0,:,:)*
>
> *;---Options to pass to ESMF_regrid*
>
> *    interp_method      = "bilinear"*
> *    opt                        = True*
>
> *    opt at SrcGridLat     = lat_src*
> *    opt at SrcGridLon     = lon_src*
> *    opt at DstGridLat     = lat_dst*
> *    opt at DstGridLon     = lon_dst*
>
> *    opt at SrcRegional    = True    ; Default is False*
> *    opt at DstRegional    = True*
>
> *    opt at CopyVarCoords  = False    ; This is the default in V6.1.0 (not
> 6.1.0-beta)*
> *    opt at ForceOverwrite = True*
>
> *;---Debug information*
> *    opt at PrintTimings   = True*
> *    opt at Debug          = True*
>
> In summary, I have the following doubts:
>
> 1) How can I keep the coordinates of each variable in a proper way?
> 2) How can I keep the dimensions exactly as in my source files?
> 3) To create the weight files in a separate script, is there any template
> I should base on for this case?
> 4) How can I add XLAT and XLONG in my regridded files like they are in the
> original wrfout* files?...like this:
>
> *variables:*
> * char Times(Time, DateStrLen) ;*
> * float XLAT(Time, south_north, west_east) ;*
> * XLAT:FieldType = 104 ;*
> * XLAT:MemoryOrder = "XY " ;*
> * XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;*
> * XLAT:units = "degree_north" ;*
> * XLAT:stagger = "" ;*
> * XLAT:coordinates = "XLONG XLAT" ;*
> * float XLONG(Time, south_north, west_east) ;*
> * XLONG:FieldType = 104 ;*
> * XLONG:MemoryOrder = "XY " ;*
> * XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;*
> * XLONG:units = "degree_east" ;*
> * XLONG:stagger = "" ;*
> * XLONG:coordinates = "XLONG XLAT" ;*
>
> I will really appreciate any help/clue about this.
>
> In case it is helpful my script and files are in the following path in
> Cheyenne:
>
> */glade/scratch/mirce/LaSierra/FullDomainForcing/WRF/second_option*
>
> If it would be better to paste here my the script I will be happy to do it!
>
> Thanks a lot in advance!
> Mirce.
>
>
>
>
>
> _______________________________________________
> 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/20181206/8a65efab/attachment.html>


More information about the ncl-talk mailing list