Re: [netcdfgroup] Enveloping fields of data in user defined types while storing in netCDF format

Dear all,

As I have found out, netCDF should be built with HDF5 support to be able to benefit from compound types. I installed HDF5 and recompiled netCDF with HDF5 support and now I can benefit from compound types. First, I create the file to be written with:

*nf90_create(FILE_NAME, NF90_HDF5, ncid)*

Up till here everything is OK. Then I define the compound type with:

*nf90_def_compound(ncid, sizeof(ep_data), "ecopath_data", typeid)*

where it gives the error: "NetCDF: HDF error STOP Stopped". If I further add the below line which defines a field for the compound type; without resolving the former error:

*nf90_insert_compound(ncid, typeid, "biomass", 1, field_typeid)*

The error changes to " NetCDF: Not a valid data type or _FillValue type mismatch. STOP Stopped." All the errors come as runtime errors and the code compiles flawlessly. I am wrestling through the documentation but many commands miss explanation, e.g. *NF90_FILL_REAL* (to fill _FillValue), *NF90_PUT_VARA* (to flush array into the defined compound field) etc.

I would be glad if someone can help me on the matter,

Regards,

Ekin


On 02/23/2012 11:36 AM, Ekin Akoglu wrote:
Dear all,

This time around I have come up with a problem concerning compound types. I scripted a FORTRAN subroutine to write data in compound form into a .nc file and it compiles perfectly, however, it gives exactly the error "Unknown error" when I run the model calling the ncwrite function after model run once is completed. My FORTRAN subroutine file is attached. It gives the error when it reaches the line with "nf90_def_compound" function. My netCDF version is 4.1.3 and fortran compiler is gfortran 4.4.5. I had compiled netCDF with --disable-netcdf-4 option. Could this be the cause of the problem?

Regards,

Ekin

On 02/23/2012 10:58 AM, Ekin Akoglu wrote:
Dear all,

I have come up with an answer to my question, that is, user-defined "compound types" in netCDF. The compound types are not very well documented under FORTRAN API, however, section for C API gives also an example where one can develop on for FORTRAN. If you are also interested please see: http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f90/Compound-Types.html#Compound-Types

Thank you...

Ekin





On 02/22/2012 10:03 PM, Ekin Akoglu wrote:
Dear all,

I am quite inexperienced in using netCDF FORTRAN API and netCDF format in storing data. Currently I am struggling on a problem. I have user derived data types in FORTRAN with multiple components, i.e. fields, such as:

ep_data%biomass
ep_data%pob
....

ms_data%biomass
ms_data%age
...

Is there a way to envelope the fields (after % sign) under e.g. "ms_data" and "ep_data" defined types when writing in a single netcdf file so that the "biomass" field of "ms_data" does not interfere with the "biomass" field of "ep_data" while reading it from the .nc file? I would be glad to hear if you have suggestions on the matter.

Regards,

--
*Ekin Akoglu*

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@xxxxxxxxxxxxxxx <mailto:ekin@xxxxxxxxxxxxxxx>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27


_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit:http://www.unidata.ucar.edu/mailing_lists/


--
*Ekin Akoglu*

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@xxxxxxxxxxxxxxx <mailto:ekin@xxxxxxxxxxxxxxx>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27


_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit:http://www.unidata.ucar.edu/mailing_lists/


--
*Ekin Akoglu*

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@xxxxxxxxxxxxxxx <mailto:ekin@xxxxxxxxxxxxxxx>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27


_______________________________________________
netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/


--
*Ekin Akoglu*

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@xxxxxxxxxxxxxxx <mailto:ekin@xxxxxxxxxxxxxxx>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27
  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: