Reading dates from a NetCDF file using Fortran - date

I have to use Fortran for some calculations using data from NetCDF files. And, depending on user selections, I 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.
After many searches I have a plan to attack this problem, but want to ask the experts before.
My plan is as follows:
Use the UDUNITS package 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.
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?

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.

Related

Using a holiday calendar in kdb?

has anyone ever implemented a holiday calendar in kdb?
it's pretty easy to exclude weekends or to create a function to get nextweekday or previous weekday, but what if you want to also take into account public holidays / bank holidays?
What have people done in order to account for this?
A rudimentary way is to create a file with known bank holidays across LDN & NY let's say - but is there a more automated way?
You may want to take a look at holiday.q on Github. Note that NYSE rules change from time to time so you may need to make some adjustments to bring that code up to date.
Most places will have purchased some form of calendar data product (.e.g Copp Clark). From that you'd build a suite of functions for getPrevBizDay etc, and you'd do it for all regions. It will also have future holidays.
Alternatively I'm sure there are some open source holiday data downloads you could scrape from the web and from them you could manually put together a table (perhaps it would be an annual once-off process to update it for the next year).

The analog of java.util.Calendar in Ionic

I need to do calculations like:
Given Unix time, tell the day of week.
Add given number of seconds to the known date, and get the new date.
Get the time (duration) difference between the two dates.
Ideally it should figure out for me the number of working days between the two Unix times but I understand that this may be too much.
When using Java, I would use java.util.Calendar for all these tasks. Which tools should be used in Ionic framework to get the same functionality? I tried to google "calendar ionic" but all results point to the Calendar GUI component that is not relevant for my task.

Date/Time Revit Shared Parameter

I am a brazilian student and I work on a research Project where I need to develop plug-ins for Autodesk Revit.
In the midst of my research, some doubts have arisen.
How can I do to insert into a Revit family a shared parameter/project parameter in date/time format ?
Use a string and format it any way you like. Revit parameters do not provide built-in support for date and time.

Strange date format

I am working with a partner who is producing a delimited file for me. The dates are formatted as:
2013.07.06 AD at 01:00:00 GMT
The other company doesn't really have an IT department, so they can't tell me where the format came from. Assuming it is a standard date format, does anyone know which library or database engine would produce this format without a custom format string?
Thank you in advance.
UPDATE:
The partner in question was able to get an answer. For reasons that make no sense to me, the underlying software, written in Java, explicitly formats the date this way, with the " at " and era and time zone indicators. A rather strange choice for a file that is supposed to be consumed by a computer program with no human interaction - they produce a beautiful, human-reasonable Excel file from the same data.
Anyways, thanks for looking and commenting.

Coldfusion: cfspreadsheet reading date incorrectly

Im using cfspreadsheet to read data from spreadsheets inside one of my applications. I've had a great deal of difficulty dealing with date columns. If I format the cell as date english (NZ) it displays right in the spreadsheet, but when I try to upload it switched the day and month. But If I change the format to a custom "dd/mm/yyyy" format it will upload without a problem.
Why would using the default date formats within the spreadsheet mess up the format when a custom one doesn't? Is there a work around?
I was using the Date Type "*14/03/2001".
The * means that it will:
respond to changes in regional date and time settings that are specified for the operating system.
So it must have been getting turned about by java or CF somewhere along the way. I changed it to the same date mask without the asterisk and the problem stopped occurring.