Re: NCL Help

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed, 7 Oct 2009 06:20:55 -0600

Hi A.R.

You have assigned the names of the dimensions to your coordinate
variables but you have not assigned the values.
After the lines:

TotBC!0 = "lat"

TotBC!1 = "lon"

you need to add:

TotBC&lat = lat

TotBC&lon = lon

You also need to make sure that you have as many coordinate values as
data values along the ROW and COL dimensions. This you would do by
setting your variables mlon and nlat to 331 and 221. But there are
possibly some additional issues: your code is associating the last
dimension named 'COL' to the longitude and the next to last dimension
named 'ROW' to latitude. By normal conventions the ROW dimension is
more likely to be the longitude, in which case you will need to
reorder the dimensions to draw properly. Additionally based on the
metadata in the global attributes, it does not like like this data is
actually global in which case you would not want to use lonGlobeF and
latGlobeF. The metadata suggests to me that the center of the
projection is at longitude 75 east and latitude 17.499... north. The
lower left corner is at 28.146... longitude and latitude -20.714.
There is also a step size of 27000 (probably meters) along each axis.
Unfortunately, we do not currently have user-accessible functions for
generating the lats and lons for this type of data. You could look
into using the PROJ projection library (http://trac.osgeo.org/proj/).
Also perhaps someone else will have a better idea.

  -dave

On Oct 7, 2009, at 5:30 AM, A.R Ragi wrote:

Dear NCL users,

I was trying to write the black carbon and organic carbon
concentration script from the STEM model output.

The output contains BC1, BC2,OC1, OC2.

But it doesn't contains the Latitude and longitude. Last time asked
about the doubt in ncl talk and so from the reply I tried to add lat
and lon using both fspan and latGlobeF and lonGlobeF.

But still saying error remains.

I'm sure that the error remains with my code itself.

Can you please check the code and help me.

The file description and my code is following.

The description of the file is:

Variable: f (file variable)

filename: TROUT.01-02-00
path: TROUT.01-02-00.nc
    file global attributes:
       IOAPI_VERSION : $Id: @(#) ioapi library version 3.0 $
       EXEC_ID : 3.0
       FTYPE : 1
       CDATE : 2009252
       CTIME : 61455
       WDATE : 2009252
       WTIME : 61455
       SDATE : 2006002
       STIME : 0
       TSTEP : 60000
       NTHIK : 1
       NCOLS : 331
       NROWS : 221
       NLAYS : 41
       NVARS : 31
       GDTYP : 3
       P_ALP : 17.5
       P_BET : 17.5
       P_GAM : 0
       XCENT : 75
       YCENT : 17.49999618530273
       XORIG : 28.14615058898926
       YORIG : -20.71478080749512
       XCELL : 27000
       YCELL : 27000
       VGTYP : 2
       VGTOP : 1
       VGLVLS : <ARRAY of 42 elements>
       GDNAM : WRF
       UPNAM :
       VAR-LIST : SO2 VSO2 SO2LPS
NOX NOY HC1 HC2
HC3 BIOMCO Hg CO
CO_TRACER1 CO_TRACER2 CO_TRACER3 CO_TRACER4
CO_TRACER5 CO_TRACER6 CO_TRACER7 CO_TRACER8
CO_TRACER9 CO_TRACER10 CO_TRACER11 SULF
BC1 BC2 OC1 OC2
SSF SSC DUST1 DUST2
       FILEDESC : Generated by program AQMS
       HISTORY :
    dimensions:
       TSTEP = 4 // unlimited
       DATE-TIME = 2
       LAY = 41
       VAR = 31
       ROW = 221
       COL = 331
    variables:
       integer TFLAG ( TSTEP, VAR, DATE-TIME )
          units : <YYYYDDD,HHMMSS>
          long_name : TFLAG
          var_desc : Timestep-valid flags: (1) YYYYDDD or (2)
HHMMSS

       float SO2 ( TSTEP, LAY, ROW, COL )
          long_name : SO2
          units : ppbv
          var_desc : Species Concentration

       float VSO2 ( TSTEP, LAY, ROW, COL )
          long_name : VSO2
          units : ppbv
          var_desc : Species Concentration

       float SO2LPS ( TSTEP, LAY, ROW, COL )
          long_name : SO2LPS
          units : ppbv
          var_desc : Species Concentration

       float NOX ( TSTEP, LAY, ROW, COL )
          long_name : NOX
          units : ppbv
          var_desc : Species Concentration

       float NOY ( TSTEP, LAY, ROW, COL )
          long_name : NOY
          units : ppbv
          var_desc : Species Concentration

       float HC1 ( TSTEP, LAY, ROW, COL )
          long_name : HC1
          units : ppbv
          var_desc : Species Concentration

       float HC2 ( TSTEP, LAY, ROW, COL )
          long_name : HC2
          units : ppbv
          var_desc : Species Concentration

       float HC3 ( TSTEP, LAY, ROW, COL )
          long_name : HC3
          units : ppbv
          var_desc : Species Concentration

       float BIOMCO ( TSTEP, LAY, ROW, COL )
          long_name : BIOMCO
          units : ppbv
          var_desc : Species Concentration

       float Hg ( TSTEP, LAY, ROW, COL )
          long_name : Hg
          units : ppbv
          var_desc : Species Concentration

       float CO ( TSTEP, LAY, ROW, COL )
          long_name : CO
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER1 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER1
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER2 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER2
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER3 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER3
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER4 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER4
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER5 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER5
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER6 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER6
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER7 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER7
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER8 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER8
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER9 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER9
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER10 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER10
          units : ppbv
          var_desc : Species Concentration

       float CO_TRACER11 ( TSTEP, LAY, ROW, COL )
          long_name : CO_TRACER11
          units : ppbv
          var_desc : Species Concentration

       float SULF ( TSTEP, LAY, ROW, COL )
          long_name : SULF
          units : microgram/m3
          var_desc : Species Concentration

       float BC1 ( TSTEP, LAY, ROW, COL )
          long_name : BC1
          units : microgram/m3
          var_desc : Species Concentration

       float BC2 ( TSTEP, LAY, ROW, COL )
          long_name : BC2
          units : microgram/m3
          var_desc : Species Concentration

       float OC1 ( TSTEP, LAY, ROW, COL )
          long_name : OC1
          units : microgram/m3
          var_desc : Species Concentration

       float OC2 ( TSTEP, LAY, ROW, COL )
          long_name : OC2
          units : microgram/m3
          var_desc : Species Concentration

       float SSF ( TSTEP, LAY, ROW, COL )
          long_name : SSF
          units : microgram/m3
          var_desc : Species Concentration

       float SSC ( TSTEP, LAY, ROW, COL )
          long_name : SSC
          units : microgram/m3
          var_desc : Species Concentration

       float DUST1 ( TSTEP, LAY, ROW, COL )
          long_name : DUST1
          units : microgram/m3
          var_desc : Species Concentration

       float DUST2 ( TSTEP, LAY, ROW, COL )
          long_name : DUST2
          units : microgram/m3
          var_desc : Species Concentration

The code i attempted is:

;Add Coordinate variables

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"

begin

;

; Read a netCDF file using addfile.

;

a = addfile("TROUT.01-02-00.nc","r")

wks=gsn_open_wks("ps","BCconcentration")

;

;Add Coordinate variables

;

;nlat = 100

;mlon = 150

;lat = fspan(-59.875,20,nlat)

;lon = fspan(60,120,mlon)

;lat!0 = "lat"

;lat&lat = lat

;lat_at_units = "degress_north"

;lat_at_long_name = "latitude"

;lon!0 = "lon"

;lon&lon = lon

;lon_at_units = "degress_east"

;lon_at_long_name = "longitude"

         mlon = 150

         lon = lonGlobeF(mlon, "lon", "longitude", "degrees_east")

         nlat = 100

         lat = latGlobeF(nlat, "lat", "latitude", "degrees_north")

bcc1 = a->BC1(0,0,:,:)

bcc2 = a->BC2(0,0,:,:)

TotBC = bcc1+bcc2

TotBC!0 = "lat"

TotBC!1 = "lon"

gsn_define_colormap(wks,"gui_default")

   res = False

   res_at_gsnSpreadColors = True

   res_at_mpFillOn = False

   res_at_cnFillOn = True

   res_at_mpMinLonF = -140

   res_at_mpMaxLonF = -65

   res_at_mpMinLatF = 10.

   plot = gsn_csm_contour_map_ce(wks,TotBC,res) ; create plot

end

---
I'm waiting for your valuable reply. Please reply when you get time.
Thanks in advance.
--
A.R.Ragi or simply A.R
MTech Atmospheric Science
CUSAT/CDAC
+919960462099
Sent from Maharashtra, India
_______________________________________________
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 Oct 07 2009 - 06:20:55 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 09 2009 - 08:29:22 MDT