[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[UDUNITS #FLZ-896534]: compilation errors for udunits.inc on SUN with f90
- Subject: [UDUNITS #FLZ-896534]: compilation errors for udunits.inc on SUN with f90
- Date: Mon, 19 Dec 2011 16:53:48 -0700
Steve,
> OK, we got readgeneral.F to compile by reinstalling udunits, changing
> a directive to a different format,
> and using f77 and linking to several libraries like so but see new
> errors below:
>
> Here's what we had to do to get it working with SUN Fortran - main
> trick was changing the syntax of
> the directive as noted.
>
> I reinstalled udunits to /usr/local so /usr/local/udunits no longer
> exists. And no need to change the udunits.inc file as it works
> now. I changed your readgeneral-cdrgsun.F program to the proper
> udunits location and #include preprocessing command.
Just FYI, the "readgeneral" program isn't mine: it's from somewhere in UCAR
(I'm with the Unidata program, which is outside of NCAR). The way "readgeneral"
uses my UDUNITS package isn't very portable, so I get a lot of questions about
it.
> I also created a
> readgeneral-cdrgsun.job which has the proper library links to compile
> the program (I didn’t add an output file, but you can if needed). It
> needs to reference both the netcdf, netcdff, and ludunits libraries.
> And the file extension has to be a capital F to compile
> thepreprocessing parts correctly.
>
> See link
> http://www.unidata.ucar.edu/support/help/MailArchives/udunits/msg00511.html
> as to why need #define and #include c version instead of define and
> include fortran version.
>
> Fortran-77 doesn't have a standard "include" mechanism. The file
> "udunits.inc"
>
> is, therefore, designed to be included by the C preprocessor and not
> by any
>
> Fortran compiler. The file "udunits.f" contains the following
>
> include '/usr/local/unidata/include/udunits.inc'
>
> Change this to
>
> #include "/usr/local/unidata/include/udunits.inc"
>
>
> Lynne
>
> Now I have modified readgeneral.F for a new data set. It compiles
> fine but
> when I run it I get this error message:
>
> ncattinq: ncid 65536; varid 2; attname "units": NetCDF: Attribute not
> found
>
> And here is the dump of the data set. Can you help? How can "units"
> be
> wrong?
> Thanks
> Steve
>
>
> $ ncdump -h pdsisc.monthly.maps.1850-2010.fawc=1.r2.5x2.5.ipe=2.nc
> netcdf pdsisc.monthly.maps.1850-2010.fawc\=1.r2.5x2.5.ipe\=2 {
> dimensions:
> time = UNLIMITED ; // (1932 currently)
> lat = 55 ;
> lon = 144 ;
> variables:
> float lat(lat) ;
> lat:long_name = "latitute in degrees, negative for
> the Southern Hemisphere" ;
> float lon(lon) ;
> lon:long_name = "longitude in degrees, negative for
> the Western Hemisphere" ;
> float time(time) ;
...
The second variable is the "lon" variable. It doesn't have a "units" attribute,
so that's why the program failed.
> time:long_name = "time in years for mid-point of the
> month" ;
> time:_FillValue = -99999.f ;
> float sc_PDSI_pm(time, lat, lon) ;
> sc_PDSI_pm:scale = 1.f ;
> sc_PDSI_pm:long_name = "Monthly Self-calibrated
> Palmer Drought Severity Index using Penman-Monteith PE" ;
> sc_PDSI_pm:missing_value = -99999.f ;
> sc_PDSI_pm:_FillValue = -99999.f ;
>
> // global attributes:
> :creation_time = "Wed Oct 26 10:25:40 MDT 2011" ;
> :Conventions = "NCAR" ;
> :source_file = "tmp2/pdsisc.monthly.maps.
> 1850-2010.fawc=1.r2.5x2.5.ipe=2" ;
> :description = "\n",
> "Monthly Self-calibrated Palmer Drought
> Severity Index (scPDSI) \n",
> "calculated using observed surface air
> temperature (HadCRUT3 from \n",
> "http://www.cru.uea.ac.uk/cru/data/
> temperature/ ) and \n",
> "precipitation (from Dai et al. (1997,
> J.Clim: for 1870-1947) + \n",
> "Chen et al. (2002, J. Hydromet.: for
> 1948-1978 + GPCP v2.2 for \n",
> "1979-present. The Dai and Chen P data were
> adjusted to have the \n",
> "same mean as the GPCP data over the
> 1979-1996 period). \n",
> "Calibration (or reference) period is
> 1950-1979. Documention: \n",
> "Dai, A., 2011a: Characteristics and trends
> in various forms of the \n",
> "Palmer Drought Severity Index (PDSI) during
> 1900-2008. J. Geophys. \n",
> "Res., 116, D12115, doi:
> 10.1029/2010JD015541.\t\t\t \n",
> "Dai, A., K. E. Trenberth, and T. Qian, 2004:
> A global data set of \n",
> "Palmer Drought Severity Index for 1870-2002:
> Relationship with soil\n",
> "moisture and effects of surface warming. J.
> Hydrometeorology, 5, \n",
> "1117-1130. Data source: Dr. A. Dai/NCAR (address@hidden
> ). See \n",
> "http://www.cgd.ucar.edu/cas/catalog/climind/pdsi.html
> for updates. \n",
> "WARNING: PDSI and scPDSI over the higher
> latitudes (e.g., >50deg.) \n",
> "may not be a good proxy of soil moisutre
> content. Also, PDSI and \n",
> "scPDSI are highly autocorrelated indices not
> good at resolving \n",
> "sub-seasonal variations. Please use with
> caution! " ;
>
> Dr. Stephen C. Piper
> Scripps CO2 Program
> Scripps Institution of Oceanography
> La Jolla, CA 92093-0244
> tel: 858-534-3991
> fax: 858-534-8814
Regards,
Steve Emmerson
Ticket Details
===================
Ticket ID: FLZ-896534
Department: Support UDUNITS
Priority: Normal
Status: Closed