Re: Writing new netcdf file from WRF data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Nov 18 2010 - 21:27:35 MST

Zach

The best debug method is to use "print" and "printVarSummary".
Use *lots* of them.

  nlat = 1
  mlon = 1

lat = fspan(40,75,nlat)
lon = fspan(110,160,mlon)

print(lat) ; ONE value
print(lon) ; One value

On 11/18/10 7:47 PM, Zack Taylor wrote:
> Hello NCL,
>
> I'm trying to write a new netcdf file after calculating total column CO
> from WRF-Chem data. I'm able to successfully write the data itself to
> the file (attached ncview screen shot), but there seems to be no
> associated lat / lon information. Following this, I'm using CDO tools to
> convert to grib, and I'm getting a "unsupported generic grid" error.

This is not a CDO issue per se.
The WRF netCDF are not CF compliant. CDO demands that.
>
> So, I'm attempting to create and add the lat/lon information following
> previous NCL posts. Below is what I'm trying to do by creating a lat /
> lon grid. The NCL script doesn't fail anywhere, yet when using CDO, I
> still get the "unsupported generic grid" error message.

The created file is *not* CF compliant ... hence failure.
>
> I'm not sure if this is a WRF lat/lon, NCL or CDO issue, but any help or
> direction would be greatly appreciated.

Suffice it to say, it is not a "WRF lat/lon, NCL or CDO issue" !

==

If your variable, "MC_a_totco" is 3D
                          ; read from WRF-chem
XLAT = f->XLAT(0.:,:) ; (south_north, west_east)
XLONG = f->XLONG(0,:,:)
printVarSummary(XLAT)
printVarSummary(XLONG)

system("/bin/rm -f WRF_TOTCO_KF_"+day+".nc") ; remv any pre-existing file
cdf_KF = addfile("WRF_TOTCO_KF_"+day+".nc" ,"c")
MC_a_totco!0 = "Time"
MC_a_totco!1 = "south_north"
MC_a_totco!2 = "west_east"
MC_a_totco@long_name = "..."
MC_a_totco@units = "..."
MC_a_totco@coordinates = "XLAT XLONG"

ncdf_KF->MC_a_totco = MC_a_totco
ncdf_KF->XLAT = XLAT
ncdf_KF->XLONG = XLONG
>
> Thanks,
> Zack
>
>
> day = 22
> ncdf_KF = addfile("WRF_TOTCO_KF_"+day+".nc" ,"c") ; open
> output netCDF file
>
> nlat = 1
> mlon = 1
>
> lat = fspan(40,75,nlat)
> lon = fspan(110,160,mlon)
>
> MC_a_totco!0 = "lat"
> MC_a_totco@lat = lat
> lat_at_units = "degrees_north"
> lat_at_long_name = "latitude"
>
> MC_a_totco!1 = "lon"
> MC_a_totco@lon = lon
> lon_at_units = "degrees_east"
> lon_at_long_name = "longitude"
>
> ncdf_KF->MC_a_totco = MC_a_totco
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> 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 Thu Nov 18 21:27:42 2010

This archive was generated by hypermail 2.1.8 : Fri Nov 19 2010 - 11:51:06 MST