[Thread Prev][Thread Next][Index]

Re: Bug in isCoord? and prob with addXml.pl



Hi Andrew,

Thanks for the bug fix. The second bug had already been fixed; both bug fixes will be in the next release of LAS.

I created a XML file from your DODS URL using the latest version of addXml, plugged into LAS and it works -- kind of. Ferret runs out of memory if you attempt to visualize the full geographical range; this is easily fixed by using a LAS <init_script> (see the documentation). I've attached the XML file for you to peruse.

Cheers.
 

Andrew Woolf wrote:

Two things:

(1) netCDF allows scalar variables (having ndims==0). These, of course,
are not indexed by any coordinate variable. In LASNetCDF.pm, however,
the function isCoord() tries to get the name of the first dimension, unless
the variable has more than one dimension. This seems to be a bug. The fix
is to replace:
 return 0 if (scalar @dims > 1);
by:
 return 0 if (scalar @dims != 1);

(2) I have what I believe to be a COARDS-compliant netCDF but addXml.pl
has a problem with it. During the parsing, it reports:
Dimension LONGITUDE_U doesn't have a coordinate variable at LASNetCDF.pm line
669

The header (or indeed whole file!) is available via DODS at
http://www.nerc-essc.ac.uk/cgi-bin/nph-dods/OCCAM/d4733.restart1_a.nc.html

I'd be very grateful if someone could suggest what's going wrong. I've almost
hit my limit of picking through the perl!

The file in question is very large (495MB), so the ncdump -h for it is below
if you don't want to inspect it via DODS.

Regards,
 - Andrew

 % ncdump -h d4733.restart1_a.nc
netcdf d4733.restart1_a {
dimensions:
        LONGITUDE_T = 1440 ;
        LATITUDE_T = 577 ;
        LONGITUDE_U = 1440 ;
        LATITUDE_U = 577 ;
        DEPTH = 36 ;
        DEPTH_EDGES = 37 ;
variables:
        int TIMESTEP ;
                TIMESTEP:long_name = "Timestep" ;
        float SECONDS ;
                SECONDS:long_name = "Model Seconds" ;
                SECONDS:units = "seconds" ;
        float DAY ;
                DAY:long_name = "Model Day" ;
                DAY:units = "days" ;
        float YEARS ;
                YEARS:long_name = "Model Year" ;
                YEARS:units = "years" ;
        int KMT(LATITUDE_T, LONGITUDE_T) ;
                KMT:long_name = "T-point mask" ;
                KMT:_FillValue = 0 ;
                KMT:T_GRID = 1 ;
        float LONGITUDE_T(LONGITUDE_T) ;
                LONGITUDE_T:long_name = "Longitude" ;
                LONGITUDE_T:units = "degrees_east" ;
                LONGITUDE_T:spacing = "even" ;
        float LATITUDE_T(LATITUDE_T) ;
                LATITUDE_T:long_name = "Latitude" ;
                LATITUDE_T:units = "degrees_north" ;
                LATITUDE_T:spacing = "even" ;
        int KMU(LATITUDE_U, LONGITUDE_U) ;
                KMU:long_name = "U-point mask" ;
                KMU:_FillValue = 0 ;
                KMU:T_GRID = 0 ;
        float LONGITUDE_U(LONGITUDE_U) ;
                LONGITUDE_U:long_name = "Longitude" ;
                LONGITUDE_U:units = "degrees_east" ;
                LONGITUDE_U:spacing = "even" ;
        float LATITUDE_U(LATITUDE_U) ;
                LATITUDE_U:long_name = "Latitude" ;
                LATITUDE_U:units = "degrees_north" ;
                LATITUDE_U:spacing = "even" ;
        float FREE_SURFACE_HEIGHT(LATITUDE_T, LONGITUDE_T) ;
                FREE_SURFACE_HEIGHT:long_name = "Free Surface Height" ;
                FREE_SURFACE_HEIGHT:units = "cm" ;
                FREE_SURFACE_HEIGHT:_FillValue = 1.e+07f ;
                FREE_SURFACE_HEIGHT:T_GRID = 1 ;
        float BAROTROPIC_U_VELOCITY(LATITUDE_U, LONGITUDE_U) ;
                BAROTROPIC_U_VELOCITY:long_name = "Barotropic U-Velocity" ;
                BAROTROPIC_U_VELOCITY:units = "cm/s" ;
                BAROTROPIC_U_VELOCITY:_FillValue = 1.e+07f ;
                BAROTROPIC_U_VELOCITY:T_GRID = 0 ;
        float BAROTROPIC_V_VELOCITY(LATITUDE_U, LONGITUDE_U) ;
                BAROTROPIC_V_VELOCITY:long_name = "Barotropic V-Velocity" ;
                BAROTROPIC_V_VELOCITY:units = "cm/s" ;
                BAROTROPIC_V_VELOCITY:_FillValue = 1.e+07f ;
                BAROTROPIC_V_VELOCITY:T_GRID = 0 ;
        float POTENTIAL_TEMPERATURE(DEPTH, LATITUDE_T, LONGITUDE_T) ;
                POTENTIAL_TEMPERATURE:long_name = "Potential Temperature" ;
                POTENTIAL_TEMPERATURE:units = "C" ;
                POTENTIAL_TEMPERATURE:_FillValue = 1.e+07f ;
                POTENTIAL_TEMPERATURE:T_GRID = 1 ;
        float DEPTH(DEPTH) ;
                DEPTH:long_name = "Depth" ;
                DEPTH:units = "cm" ;
                DEPTH:positive = "down" ;
                DEPTH:edges = "DEPTH_EDGES" ;
        float SALINITY(DEPTH, LATITUDE_T, LONGITUDE_T) ;
                SALINITY:long_name = "Salinity" ;
                SALINITY:units = "PSU" ;
                SALINITY:_FillValue = 1.e+10f ;
                SALINITY:scale_factor = 1000.f ;
                SALINITY:add_offset = 35.f ;
                SALINITY:T_GRID = 1 ;
        float U_VELOCITY(DEPTH, LATITUDE_U, LONGITUDE_U) ;
                U_VELOCITY:long_name = "U-Velocity" ;
                U_VELOCITY:units = "cm/s" ;
                U_VELOCITY:_FillValue = 1.e+07f ;
                U_VELOCITY:T_GRID = 0 ;
        float V_VELOCITY(DEPTH, LATITUDE_U, LONGITUDE_U) ;
                V_VELOCITY:long_name = "V-Velocity" ;
                V_VELOCITY:units = "cm/s" ;
                V_VELOCITY:_FillValue = 1.e+07f ;
                V_VELOCITY:T_GRID = 0 ;
        float DEPTH_EDGES(DEPTH_EDGES) ;
                DEPTH_EDGES:long_name = "Depth Edges" ;
                DEPTH_EDGES:units = "cm" ;
                DEPTH_EDGES:positive = "down" ;

// global attributes:
                :TITLE = "OCCAM Data" ;
                :FMODE = 2 ;
                :FTYPE = 2 ;
                :ROTATION = 1 ;
                :Conventions = "COARDS" ;
}

-----------------------------------------------------
Andrew Woolf  (awo@mail.nerc-essc.ac.uk)
Environmental Systems Science Centre (ESSC)
Reading University
3 Earley Gate
Whiteknights
Reading RG6 6AL
UNITED KINGDOM
Phone: +44 (0)118 931 8741   Fax: +44 (0)118 931 6413
-----------------------------------------------------

--
Joe Sirott
 
<?xml version='1.0' ?>
 <!DOCTYPE spec SYSTEM "spec.dtd" [ 
  <!ENTITY StdOperations SYSTEM "operations.xml">]>
   <lasdata>
    <operations url="http://pc.sirvin.com/las-bin/LASserver.pl";>
     <ls name="LAS directory handler" class="LAS::Util" method="ls"/>
     <overlay name="Overlay two variables" class="LAS::Server::Ferret" method="overlay">
      <arg type="variable"/>
      <arg type="region"/>
      <arg type="variable"/>
      <arg type="region"/>
     </overlay>
     <compare name="Compare two variables" class="LAS::Server::Ferret" method="compare">
      <arg type="variable"/>
      <arg type="region"/>
      <arg type="variable"/>
      <arg type="region"/>
     </compare>
     <compare_data name="Data from variable comparison" class="LAS::Server::Ferret" method="compare_data">
      <arg type="variable"/>
      <arg type="region"/>
      <arg type="variable"/>
      <arg type="region"/>
     </compare_data>
     <shade name="Shade a variable" class="LAS::Server::Ferret" method="draw">
      <arg type="variable"/>
      <arg type="region"/>
     </shade>
     <line name="Draw line from variable" class="LAS::Server::Ferret" method="draw">
      <arg type="variable"/>
      <arg type="region"/>
     </line>
     <data name="Return variable data" class="LAS::Server::Ferret" method="data">
      <arg type="variable"/>
      <arg type="region"/>
     </data>
     <vrml name="Generate a VRML graphic" class="LAS::Server::Ferret" method="vrml">
      <arg type="variable"/>
      <arg type="region"/>
     </vrml>
     <vector name="Vector graphic" class="LAS::Server::Ferret" method="vector">
      <arg type="variable"/>
      <arg type="variable"/>
      <arg type="region"/>
     </vector>
     <ferret_script class="LAS::Server::Ferret" method="gen_script"/>
    </operations>
    <datasets>
     <d4733_restart1_a_nc url="http://www.nerc-essc.ac.uk/cgi-bin/nph-dods/OCCAM/d4733.restart1_a.nc"; doc="">
      <variables>
       <potential_temperature units="C" name="Potential Temperature">
        <link match="/lasdata/grids/d4733_restart1_a_nc_DEPTH_LATITUDE_T_LONGITUDE_T_grid"/>
       </potential_temperature>
       <barotropic_u_velocity units="cm/s" name="Barotropic U-Velocity">
        <link match="/lasdata/grids/d4733_restart1_a_nc_LATITUDE_U_LONGITUDE_U_grid"/>
       </barotropic_u_velocity>
       <u_velocity units="cm/s" name="U-Velocity">
        <link match="/lasdata/grids/d4733_restart1_a_nc_DEPTH_LATITUDE_U_LONGITUDE_U_grid"/>
       </u_velocity>
       <kmt name="T-point mask">
        <link match="/lasdata/grids/d4733_restart1_a_nc_LATITUDE_T_LONGITUDE_T_grid"/>
       </kmt>
       <kmu name="U-point mask">
        <link match="/lasdata/grids/d4733_restart1_a_nc_LATITUDE_U_LONGITUDE_U_grid"/>
       </kmu>
       <barotropic_v_velocity units="cm/s" name="Barotropic V-Velocity">
        <link match="/lasdata/grids/d4733_restart1_a_nc_LATITUDE_U_LONGITUDE_U_grid"/>
       </barotropic_v_velocity>
       <v_velocity units="cm/s" name="V-Velocity">
        <link match="/lasdata/grids/d4733_restart1_a_nc_DEPTH_LATITUDE_U_LONGITUDE_U_grid"/>
       </v_velocity>
       <free_surface_height units="cm" name="Free Surface Height">
        <link match="/lasdata/grids/d4733_restart1_a_nc_LATITUDE_T_LONGITUDE_T_grid"/>
       </free_surface_height>
       <salinity units="PSU" name="Salinity">
        <link match="/lasdata/grids/d4733_restart1_a_nc_DEPTH_LATITUDE_T_LONGITUDE_T_grid"/>
       </salinity>
      </variables>
     </d4733_restart1_a_nc>
    </datasets>
    <grids>
     <d4733_restart1_a_nc_DEPTH_LATITUDE_T_LONGITUDE_T_grid>
      <link match="/lasdata/axes/d4733_restart1_a_nc_DEPTH"/>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LATITUDE_T"/>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LONGITUDE_T"/>
     </d4733_restart1_a_nc_DEPTH_LATITUDE_T_LONGITUDE_T_grid>
     <d4733_restart1_a_nc_LATITUDE_U_LONGITUDE_U_grid>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LATITUDE_U"/>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LONGITUDE_U"/>
     </d4733_restart1_a_nc_LATITUDE_U_LONGITUDE_U_grid>
     <d4733_restart1_a_nc_DEPTH_LATITUDE_U_LONGITUDE_U_grid>
      <link match="/lasdata/axes/d4733_restart1_a_nc_DEPTH"/>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LATITUDE_U"/>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LONGITUDE_U"/>
     </d4733_restart1_a_nc_DEPTH_LATITUDE_U_LONGITUDE_U_grid>
     <d4733_restart1_a_nc_LATITUDE_T_LONGITUDE_T_grid>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LATITUDE_T"/>
      <link match="/lasdata/axes/d4733_restart1_a_nc_LONGITUDE_T"/>
     </d4733_restart1_a_nc_LATITUDE_T_LONGITUDE_T_grid>
    </grids>
    <axes>
     <d4733_restart1_a_nc_DEPTH units="cm" type="z">
      <v>986.946044921875
      </v>
      <v>3042.85717773438
      </v>
      <v>5235.32275390625
      </v>
      <v>7605.02685546875
      </v>
      <v>10203.83203125
      </v>
      <v>13097.2109375
      </v>
      <v>16366.7763671875
      </v>
      <v>20112.595703125
      </v>
      <v>24454.775390625
      </v>
      <v>29533.533203125
      </v>
      <v>35506.8125
      </v>
      <v>42544.41015625
      </v>
      <v>50817.96875
      </v>
      <v>60487.0078125
      </v>
      <v>71682.53125
      </v>
      <v>84491.109375
      </v>
      <v>98943.1796875
      </v>
      <v>115008.6875
      </v>
      <v>132601.421875
      </v>
      <v>151590.59375
      </v>
      <v>171816.84375
      </v>
      <v>193108.53125
      </v>
      <v>215295.84375
      </v>
      <v>238220.71875
      </v>
      <v>261742.796875
      </v>
      <v>285741.84375
      </v>
      <v>310117.6875
      </v>
      <v>334788.59375
      </v>
      <v>359688.96875
      </v>
      <v>384766.90625
      </v>
      <v>409981.59375
      </v>
      <v>435301.375
      </v>
      <v>460701.625
      </v>
      <v>486163.46875
      </v>
      <v>511672.28125
      </v>
      <v>537216.9375
      </v>
     </d4733_restart1_a_nc_DEPTH>
     <d4733_restart1_a_nc_LATITUDE_T units="degrees_north" type="y">
      <arange start="-78.125" step="0.25" size="577"/>
     </d4733_restart1_a_nc_LATITUDE_T>
     <d4733_restart1_a_nc_LONGITUDE_T units="degrees_east" type="x">
      <arange start="0.125" step="0.25" size="1440"/>
     </d4733_restart1_a_nc_LONGITUDE_T>
     <d4733_restart1_a_nc_LATITUDE_U units="degrees_north" type="y">
      <arange start="-78" step="0.25" size="577"/>
     </d4733_restart1_a_nc_LATITUDE_U>
     <d4733_restart1_a_nc_LONGITUDE_U units="degrees_east" type="x">
      <arange start="0.25" step="0.25" size="1440"/>
     </d4733_restart1_a_nc_LONGITUDE_U>
    </axes>
   </lasdata>

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement