Reading dates from a netcdf file using Fortran

I have to use Fortran for some calculations using data from NetCdf Files. And, depending on user selections, need to select only one or some months from each year.

The dates in the NetCdf file are coded sometimes as "months since XXXX-XX-XX", other times as "days since XXXX-XX-XX", others as "hours since XXXX-XX-XX XX:XX", etc.

In addition, these have to be interpreted as belonging to a certain type of calendar, which can be gregorian, julian, proleptic gregorian, 360-day, etc.

I have been searching the internet for a straight forward way to make this, but found only fragmented information.

After many searches I have a plan to attack this problem, but want to ask the experts before.

My plan is as follows:

  1. Use the UDUNITS pakcage (http://www.unidata.ucar.edu/software/udunits/udunits-2.2.16/doc/udunits/udunits2lib.html#Time) to convert the date information contained in the NetCdf file, to a julian/gregorian date. For this, I have to:

    • Bind the C code of UDUNITS to Fortran.
  2. Convert the date obtained, to the desired calendar. For this, I think that I have to use a calendar package. Which would be a good choice?.

Do you agree with this?

Thanks a lot in advance.

Antonio Serrano

Answers


I think I have found a good solution: the cdi libraries, developed by the Max-Plank Institute and distributed under the GNU GENERAL PUBLIC LICENSE Version 2.

It defines the following types of calendars: CALENDAR STANDARD, CALENDAR PROLEPTIC, CALENDAR 360DAYS, CALENDAR 365DAYS and CALENDAR 366DAYS.

This seems to be a very proven code, since it is used by cdo, a widely used tool that manages netcdf files.


Need Your Help

jquery - How to properly copy data from div to new window dynamically

jquery printing

I have a problem. Im trying to create a very simple print preview that when the user clicks the Print Preview button it will open a new window and copies the data I wanted. There are some elements ...

Validation : how to check if the file being uploaded is in excel format? - Apache POI

validation jsf apache-poi

Is there any way I can check if the file being uploaded is in excel format? I am using Apache POI library to read excel, and checking the uploaded file extension while reading the file.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.